diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 87f66a0859..53a595b551 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -627,6 +627,29 @@ jobs:
name: OpenRCT2-${{ needs.build_variables.outputs.name }}-Android
path: artifacts
if-no-files-found: error
+ emscripten:
+ name: Emscripten
+ runs-on: ubuntu-latest
+ needs: [check-code-formatting, build_variables]
+ container: openrct2/openrct2-build:19-emscripten
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: ccache
+ uses: hendrikmuhs/ccache-action@v1.2.13
+ with:
+ key: emscripten
+ - name: Install GCC problem matcher
+ uses: ammaraskar/gcc-problem-matcher@master
+ - name: Build OpenRCT2
+ run: |
+ . scripts/setenv
+ build-emscripten
+ - name: Upload artifacts (CI)
+ uses: actions/upload-artifact@v4
+ with:
+ path: build/www
+ name: OpenRCT2-${{ needs.build_variables.outputs.name }}-emscripten
release:
name: Release
runs-on: ubuntu-latest
diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml
index 0c73415a91..33b25d4d85 100644
--- a/.github/workflows/clang-tidy.yml
+++ b/.github/workflows/clang-tidy.yml
@@ -12,7 +12,7 @@ on:
jobs:
clang-tidy-check:
runs-on: ubuntu-latest
- container: openrct2/openrct2-build:13-jammy
+ container: openrct2/openrct2-build:19-noble
steps:
- uses: actions/checkout@v4
- uses: ZehMatt/clang-tidy-annotations@v1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb249e67e6..1a20eed63d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,9 +69,9 @@ set(TITLE_SEQUENCE_VERSION "0.4.14")
set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip")
set(TITLE_SEQUENCE_SHA1 "6c04781b959b468e1f65ec2d2f21f5aaa5e5724d")
-set(OBJECTS_VERSION "1.4.12")
+set(OBJECTS_VERSION "1.5.1")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip")
-set(OBJECTS_SHA1 "d9b745f3b9dacf5c204a43375e4d93dfe3548938")
+set(OBJECTS_SHA1 "e922b9fd779e7752176f1d0d8766c2ee6ad1e41b")
set(OPENSFX_VERSION "1.0.5")
set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip")
@@ -81,9 +81,9 @@ set(OPENMSX_VERSION "1.6")
set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip")
set(OPENMSX_SHA1 "ba170fa6d777b309c15420f4b6eb3fa25082a9d1")
-set(REPLAYS_VERSION "0.0.84")
+set(REPLAYS_VERSION "0.0.86")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
-set(REPLAYS_SHA1 "90B848AB344E29A2CF1E3E48539F06F5845772C3")
+set(REPLAYS_SHA1 "637E73F20C03DCD52ACA36FAEE15DADB31797FE0")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")
diff --git a/cmake/FindSpeexDSP.cmake b/cmake/FindSpeexDSP.cmake
new file mode 100644
index 0000000000..d1267499fd
--- /dev/null
+++ b/cmake/FindSpeexDSP.cmake
@@ -0,0 +1,40 @@
+#
+# - Find speexdsp libraries
+#
+# SPEEXDSP_INCLUDE_DIRS - where to find speexdsp headers.
+# SPEEXDSP_LIBRARIES - List of libraries when using speexdsp.
+# SPEEXDSP_FOUND - True if speexdsp is found.
+
+find_package(PkgConfig QUIET)
+pkg_search_module(PC_SPEEXDSP QUIET speexdsp)
+
+find_path(SPEEXDSP_INCLUDE_DIR
+ NAMES
+ speex/speex_resampler.h
+ HINTS
+ ${PC_SPEEXDSP_INCLUDE_DIRS}
+)
+
+find_library(SPEEXDSP_LIBRARY
+ NAMES
+ speexdsp
+ HINTS
+ ${PC_SPEEXDSP_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SpeexDSP
+ REQUIRED_VARS SPEEXDSP_LIBRARY SPEEXDSP_INCLUDE_DIR
+ VERSION_VAR PC_SPEEXDSP_VERSION)
+
+if(SPEEXDSP_FOUND)
+ set(SPEEXDSP_LIBRARIES ${SPEEXDSP_LIBRARY})
+ set(SPEEXDSP_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR})
+ set(SPEEX_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR})
+else()
+ set(SPEEXDSP_LIBRARIES)
+ set(SPEEXDSP_INCLUDE_DIRS)
+ set(SPEEX_INCLUDE_DIRS)
+endif()
+
+mark_as_advanced(SPEEXDSP_LIBRARIES SPEEXDSP_INCLUDE_DIRS SPEEX_INCLUDE_DIRS)
diff --git a/data/language/ar-EG.txt b/data/language/ar-EG.txt
index b280c760da..5f11f02f35 100644
--- a/data/language/ar-EG.txt
+++ b/data/language/ar-EG.txt
@@ -1159,17 +1159,6 @@ STR_1773 :Only one on-ride photo section allowed per ride
STR_1774 :Only one cable lift hill allowed per ride
STR_1777 :موسيقي الرحلة
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda costume
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiger costume
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elephant costume
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Roman costume
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla costume
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snowman costume
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Knight costume
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaut costume
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandit costume
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriff costume
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirate costume
STR_1790 :Select uniform colour for this type of staff
STR_1791 :{WINDOW_COLOUR_2}Uniform colour:
STR_1792 :Responding to {STRINGID} breakdown call
diff --git a/data/language/ca-ES.txt b/data/language/ca-ES.txt
index 085c541dae..c145721435 100644
--- a/data/language/ca-ES.txt
+++ b/data/language/ca-ES.txt
@@ -1165,17 +1165,6 @@ STR_1773 :Només es permet una secció de fotos de record per atracció.
STR_1774 :Només es permet un cable d’elevació per atracció.
STR_1777 :Música de l’atracció
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Disfressa de panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Disfressa de tigre
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Disfressa d’elefant
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Disfressa de romà
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Disfressa de goril·la
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Disfressa de ninot de neu
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Disfressa de cavaller
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Disfressa d’astronauta
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Disfressa de bandit
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Disfressa de xèrif
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Disfressa de pirata
STR_1790 :Seleccioneu el color de l’uniforme d’aquest tipus d’empleats.
STR_1791 :{WINDOW_COLOUR_2}Color de l’uniforme:
STR_1792 :Responent la trucada d’avaria de {STRINGID}.
diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt
index ab04e6905e..74dda35372 100644
--- a/data/language/cs-CZ.txt
+++ b/data/language/cs-CZ.txt
@@ -1161,17 +1161,6 @@ STR_1773 :Je povolena jen jedna fotobuňka na atrakci
STR_1774 :Je povolen pouze jeden výtah na atrakci
STR_1777 :Hudba atrakcí
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tygr
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Slon
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Říman
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorila
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Sněhulák
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Rytíř
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Skafandr
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandita
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Šerif
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirát
STR_1790 :Vybrat barvu uniformy těchto zaměstnanců
STR_1791 :{WINDOW_COLOUR_2}Barva uniformy:
STR_1792 :Reaguje na poruchu {STRINGID}
diff --git a/data/language/da-DK.txt b/data/language/da-DK.txt
index 7e6c94baf3..a274e017fc 100644
--- a/data/language/da-DK.txt
+++ b/data/language/da-DK.txt
@@ -1162,17 +1162,6 @@ STR_1773 :Kun en on-ride foto sektion, tilladt per forlystelse
STR_1774 :Kun et trækspil er tilladt per forlystelse.
STR_1777 :Forlystelses musik
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda kostume
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiger kostume
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elefant kostume
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Gladiator kostume
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla kostume
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snemands kostume
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Ridder kostume
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaut kostume
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandit kostume
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriff kostume
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirat kostume
STR_1790 :vælg uniforms farve for denne type personale
STR_1791 :{WINDOW_COLOUR_2}Uniforms farve:
STR_1792 :Reagerer på et kald til {STRINGID} på grund af nedbrud
diff --git a/data/language/de-DE.txt b/data/language/de-DE.txt
index a7a99efc9d..a7e2b19e7e 100644
--- a/data/language/de-DE.txt
+++ b/data/language/de-DE.txt
@@ -1161,17 +1161,6 @@ STR_1773 :Nur ein Fahrtfoto-Bereich pro Bahn erlaubt
STR_1774 :Nur ein Kabellifthügel pro Bahn erlaubt
STR_1777 :Attraktionsmusik
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Pandakostüm
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tigerkostüm
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elefantenkostüm
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Römerkostüm
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorillakostüm
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Schneemannkostüm
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Ritterkostüm
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronautenkostüm
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Banditenkostüm
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriffkostüm
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Piratenkostüm
STR_1790 :Uniformfarbe für diesen{NEWLINE}Mitarbeiter auswählen
STR_1791 :{WINDOW_COLOUR_2}Uniformfarbe:
STR_1792 :Unterwegs zur Reparatur von {STRINGID}
diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt
index c757fb185f..2f9f6b2840 100644
--- a/data/language/en-GB.txt
+++ b/data/language/en-GB.txt
@@ -1164,17 +1164,6 @@ STR_1773 :Only one on-ride photo section allowed per ride
STR_1774 :Only one cable lift hill allowed per ride
STR_1777 :Ride music
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda costume
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiger costume
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elephant costume
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Roman costume
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla costume
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snowman costume
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Knight costume
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaut costume
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandit costume
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriff costume
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirate costume
STR_1790 :Select uniform colour for this type of staff
STR_1791 :{WINDOW_COLOUR_2}Uniform colour:
STR_1792 :Responding to {STRINGID} breakdown call
@@ -2180,7 +2169,6 @@ STR_3136 :Warning: This design will be built with an alternative vehicle type
STR_3137 :Select Nearby Scenery
STR_3138 :Reset Selection
STR_3139 :Cable lift unable to work in this operating mode
-STR_3140 :Cable lift hill must start immediately after station
STR_3141 :Multi-circuit per ride not possible with cable lift hill
STR_3142 :{WINDOW_COLOUR_2}Capacity: {BLACK}{STRINGID}
STR_3143 :Show people on map
@@ -2212,7 +2200,7 @@ STR_3188 :Path Signs
STR_3189 :Legacy footpaths
STR_3190 :Path Extras
STR_3191 :Scenery Groups
-STR_3192 :Park Entrance
+STR_3192 :Park Entrances
STR_3193 :Water
STR_3195 :Invention List
STR_3196 :{WINDOW_COLOUR_2}Research Group: {BLACK}{STRINGID}
@@ -2617,7 +2605,7 @@ STR_5368 :Reset crash status
STR_5371 :Object selection
STR_5372 :Invert right mouse dragging
STR_5373 :Name {STRINGID}
-STR_5374 :Date {STRINGID}
+STR_5374 :Date modified {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Name already exists
@@ -3787,3 +3775,23 @@ STR_6709 :Enter Smooth Strength between {COMMA16} and {COMMA16}
STR_6710 :Stable sort
STR_6711 :Filename:
STR_6712 :Save
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Filename
+STR_6715 :Date modified
+STR_6716 :File size
+STR_6717 :File size {STRINGID}
+STR_6718 :Peep Animations
+STR_6719 :At least one guest peep animations object must be selected
+STR_6720 :At least one handyman peep animations object must be selected
+STR_6721 :At least one mechanic peep animations object must be selected
+STR_6722 :At least one security peep animations object must be selected
+STR_6723 :At least one entertainer peep animations object must be selected
+STR_6724 :Scenario Texts
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :Dive Loop (left)
+STR_6728 :Dive Loop (right)
+STR_6729 :Cable lift hill must start immediately after station or block brake
+STR_6730 :Export emscripten data
+STR_6731 :Import emscripten data
+STR_6732 :Show a button in the toolbar to rotate the view anti-clockwise
diff --git a/data/language/en-US.txt b/data/language/en-US.txt
index 7ac4ef8a73..d4e7cb53f3 100644
--- a/data/language/en-US.txt
+++ b/data/language/en-US.txt
@@ -235,3 +235,4 @@ STR_6625 :Invalid color
STR_6629 :Align toolbar buttons horizontally centered
STR_6630 :This setting will align the toolbar buttons horizontally in the center of the screen. The traditional way of aligning them is in the left and right corner.
+STR_6732 :Show a button in the toolbar to rotate the view counterclockwise
diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt
index bd3c908e1e..2485a1c87d 100644
--- a/data/language/eo-ZZ.txt
+++ b/data/language/eo-ZZ.txt
@@ -1164,17 +1164,6 @@ STR_1773 :Nur unu sur-atrakcia fotoparto estas permesita po atrakcio
STR_1774 :Nur unu kablolifta monteto estas permesita po atrakcio
STR_1777 :Muziko de atrakcio
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Pandokostumo
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tigrokostumo
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elefantokostumo
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Romianokostumo
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilokostumo
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Neĝhomokostumo
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Kavalirokostumo
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaŭtokostumo
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Banditokostumo
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Ŝerifokostumo
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Piratokostumo
STR_1790 :Elekti uniformkoloron de tiaj dungitoj
STR_1791 :{WINDOW_COLOUR_2}Uniformkoloro:
STR_1792 :Reagas al paneovoko de {STRINGID}
@@ -2180,7 +2169,6 @@ STR_3136 :Averto: Ĉi tiu desegnaĵo estos konstruita per alternativa tipo de
STR_3137 :Elekti Proksiman Pejzaĝon
STR_3138 :Vakigi Elektaĵon
STR_3139 :Kablolifto ne funkciiĝas kun ĉi tiu reĝimo de funkciado
-STR_3140 :Kablolifto-monteto devas komenci tuj post stacio
STR_3141 :Reĝimo de multaj cirkvitoj ne eblas kun kablolifto-monteto
STR_3142 :{WINDOW_COLOUR_2}Kapacito: {BLACK}{STRINGID}
STR_3143 :Montri homojn sur mapo
@@ -2212,7 +2200,7 @@ STR_3188 :Trotuaro-Surskribaĵoj
STR_3189 :Heredaĵaj trotuaroj
STR_3190 :Trotuaro-Diversaĵoj
STR_3191 :Pejzaĝo-Grupoj
-STR_3192 :Parkeniro
+STR_3192 :Parkeniroj
STR_3193 :Akvo
STR_3195 :Listo da Inventaĵoj
STR_3196 :{WINDOW_COLOUR_2}Inventaĵo-Kategorio: {BLACK}{STRINGID}
@@ -2617,7 +2605,7 @@ STR_5368 :Restarigi staton de akcidentoj
STR_5371 :Elektado de objektoj
STR_5372 :Inversigi trenadon per dekstra musobutono
STR_5373 :Nomo {STRINGID}
-STR_5374 :Dato {STRINGID}
+STR_5374 :Dato modifita {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Nomo jam ekzistas
@@ -3747,8 +3735,8 @@ STR_6671 :Montri ‘faktajn’ nomojn de dungitaro
STR_6672 :Baskuligi inter montrado de ‘faktaj’ dungitonomoj kaj dungitonumeroj
STR_6673 :Travidebla
STR_6674 :{MONTH}, Jaro {COMMA16}
-STR_6675 :Nomoj de Gastoj
-STR_6676 :Almenaŭ unu objecto de gastonomo elektendas
+STR_6675 :Nomoj de Hometoj
+STR_6676 :Almenaŭ unu objecto de hometonomo elektendas
STR_6677 :Aldoni strandojn ĉirkaŭ amasoj de akvo
STR_6678 :Fonto de altmapo:
STR_6679 :Ebenaĵo
@@ -3785,3 +3773,20 @@ STR_6709 :Entajpu glatan fortecon inter {COMMA16} kaj {COMMA16}
STR_6710 :Stabila ordigo
STR_6711 :Dosiernomo:
STR_6712 :Konservi
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Dosiernomo
+STR_6715 :Dato modifita
+STR_6716 :Dosiergrando
+STR_6717 :Dosiergrando {STRINGID}
+STR_6718 :Animacioj de Hometoj
+STR_6719 :Almenaŭ unu animacio-objekto de gasto elektendas
+STR_6720 :Almenaŭ unu animacio-objekto de faktoto elektendas
+STR_6721 :Almenaŭ unu animacio-objekto de mekanikisto elektendas
+STR_6722 :Almenaŭ unu animacio-objekto de gardisto elektendas
+STR_6723 :Almenaŭ unu animacio-objekto de amuzisto elektendas
+STR_6724 :Scenaro-Tekstoj
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :Plonĝlopo (maldekstre)
+STR_6728 :Plonĝlopo (dekstre)
+STR_6729 :Kablolifto-monteto devas komenci tuj post stacio aŭ bremso de blokparto
diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt
index 5774693e4f..bf5d345b3f 100644
--- a/data/language/es-ES.txt
+++ b/data/language/es-ES.txt
@@ -93,12 +93,13 @@ STR_0088 :Montaña Rusa Impulso Inverso
STR_0089 :Mini Montaña Rusa
STR_0090 :Trenes Mineros
STR_0091 :Atracc. Desconocida (59)
-STR_0092 :Montaña Rusa Impulso MLI
-STR_0093 :Montaña Rusa Híbrida
+STR_0092 :Montaña Rusa acelerada por LIM
+STR_0093 :Montaña Rusa Híbrida
STR_0094 :Montaña Rusa de un solo carril
STR_0095 :Montaña Rusa Alpina
STR_0096 :Montaña Rusa de madera clásica
STR_0097 :Montaña Rusa de pie clásica
+STR_0098 :Montaña Rusa acelerada por LSM
STR_0512 :Una montaña rusa pequeña de acero con una subida en espiral y vagones con asientos en línea.
STR_0513 :Una montaña rusa en el que los pasajeros permanecen de pie.
STR_0514 :Los vagones suspendidos bajo los raíles se balancean hacia los lados en las curvas.
@@ -112,7 +113,7 @@ STR_0521 :Una montaña rusa rápida con curvas cerradas y fuertes caídas. La
STR_0522 :Pequeña montaña rusa en donde los pasajeros se montan en unos vagones que recorren un monorriel.
STR_0523 :Los pasajeros viajan lentamente en vehículos autopropulsados sobre una vía.
STR_0524 :Un vagón es lanzado en un neumático a lo alto de una elevada torre de acero, cayendo libremente.
-STR_0525 :Los pasajeros viajan por unas vías retorcidas en vagones tipo bobsleigh guiados únicamente por la curvatura y los peraltes de la vía semicircular.
+STR_0525 :Los pasajeros viajan por unas vías con giro en vagones tipo bobsleigh guiados únicamente por la curvatura y los peraltes de la vía semicircular.
STR_0526 :Los pasajeros viajan en una cabina de observación giratoria que se desplaza hacia arriba en una torre alta.
STR_0527 :Una montaña rusa de acero capaz de rizos verticales.
STR_0528 :Los pasajeros viajan en botes hinchables por tubos semicirculares o totalmente cerrados.
@@ -156,7 +157,7 @@ STR_0569 :Montados bajo la vía con un arnés especial, los visitantes experi
STR_0571 :Vagones circulares giran mientras recorren sobre la zigzagueante vía de madera.
STR_0572 :Botes de gran capacidad viajan por un amplio canal, los cuales son impulsados por una cinta transportadora para después caer y hacer grandes salpicaduras.
STR_0573 :Vagones con forma de helicópteros corren por una vía de acero controlados por los pedales de los pasajeros.
-STR_0574 :Los pasajeros son sujetados tumbados por unos arneses especiales, mientras viajan por una vía retorcida con inversiones de espaldas o boca abajo.
+STR_0574 :Los pasajeros son sujetados tumbados por unos arneses especiales, mientras viajan por una vía con giros e inversiones de espaldas o boca abajo.
STR_0575 :Trenes monorraíl suspendidos transportan a la gente por el parque.
STR_0577 :Vagones que corren por una vía de madera girando en secciones especiales de inversión.
STR_0578 :Los vagones circulan por vías formando aros y recorriendo bruscas caídas y giros.
@@ -175,14 +176,15 @@ STR_0590 :Los pasajeros viajan en un submarino sumergido que viaja sobre una
STR_0591 :Barcos en forma de balsa viajan suavemente sobre un río.
STR_0593 :
STR_0598 :Los vagones de la montaña rusa invertida aceleran saliendo del andén y tomando un tramo de vía vertical, entonces vuelven marcha atrás pasando por el andén y subiendo por otro tramo de vía vertical.
-STR_0599 :Una montaña rusa compacta con vagones individuales y caídas y giros suaves.
-STR_0600 :Trenes mineros autopropulsados corren a lo largo de una vía suave y retorcida.
-STR_0602 :Los vagones se aceleran por los motores lineales de inducción.
+STR_0599 :Una montaña rusa compacta con vagones individuales y caídas con giro suaves.
+STR_0600 :Trenes mineros autopropulsados corren a lo largo de una vía suave y con giros.
+STR_0602 :Los vagones de la montaña rusa son acelerados fuera de la estación por motores de inducción lineal (LIM) para atravesar inversiones con giro a gran velocidad.
STR_0603 :Una montaña rusa estilo de madera con vías de acero, lo que le permite caídas empinadas e inversiones.
STR_0604 :Los pasajeros viajan en fila india en una pista de monorraíl estrecha, mientras corren a través de inversiones estrechas y cambios de dirección.
STR_0605 :Los pasajeros bajan por una serpenteante vía de acero, frenando para controlar su velocidad.
STR_0606 :Una montaña rusa de madera de estilo antiguo con un recorrido rápido y bruto, con muchas caídas, algunas fuerzas G laterales, y diseñada para ofrecer una experiencia ‘fuera de control’.
STR_0607 :Una intensa montaña rusa en espiral de acero y de estilo antiguo en la que los pasajeros viajan de pie.
+STR_0608 :Los vagones de la montaña rusa son acelerados por motores síncronos lineales (LSM), avanzando a toda velocidad por giros y curvas cerradas.
STR_0767 :Visitante {INT32}
STR_0768 :Manitas {INT32}
STR_0769 :Mecánico {INT32}
@@ -277,11 +279,11 @@ STR_0880 :No se puede elevar el terreno…
STR_0881 :Un objeto interfiere
STR_0882 :Cargar Partida
STR_0883 :Guardar Partida
-STR_0884 :Cargar paisaje
-STR_0885 :Guardar paisaje
-STR_0887 :Salir del editor de escenarios
-STR_0888 :Salir del editor de Vías
-STR_0889 :Salir del admin. de Vías
+STR_0884 :Cargar Paisaje
+STR_0885 :Guardar Paisaje
+STR_0887 :Salir del Editor de escenarios
+STR_0888 :Salir del Diseñador de Vías
+STR_0889 :Salir del Gestor de Diseños de vías
STR_0891 :Tomar captura de pantalla
STR_0892 :Captura de pantalla guardada como ‘{STRINGID}’
STR_0893 :¡No se pudo tomar la Captura de pantalla!
@@ -344,7 +346,7 @@ STR_0949 :¿Guardar antes de salir?
STR_0950 :Cargar Partida
STR_0951 :Salir del juego
STR_0952 :Salir del juego
-STR_0953 :Cargar paisaje
+STR_0953 :Cargar Paisaje
STR_0955 :Angulo de rotación de asiento en este tramo
STR_0956 :-180°
STR_0957 :-135°
@@ -436,7 +438,7 @@ STR_1042 :Guardar paisaje
STR_1043 :OpenRCT2 Juegos guardados
STR_1044 :OpenRCT2 Archivo de Escenario
STR_1045 :OpenRCT2 Archivo de Paisaje
-STR_1046 :OpenRCT2 Archivo de diseño de vía
+STR_1046 :OpenRCT2 Archivo de Diseño de Vía
STR_1047 :¡Guardar partida falló!
STR_1048 :¡Guardar escenario falló!
STR_1049 :¡Guardar paisaje falló!
@@ -1129,7 +1131,7 @@ STR_1738 :No se puede cambiar el numero de vueltas…
STR_1739 :Carrera ganada por visitante {INT32}
STR_1740 :Carrera ganada por {STRINGID}
STR_1741 :¡Aún sin construir!
-STR_1742 :{WINDOW_COLOUR_2}Max. visitantes en juego:
+STR_1742 :{WINDOW_COLOUR_2}Máx. visitantes en juego:
STR_1743 :Numero de visitantes máximo permitido en este juego al mismo tiempo
STR_1744 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16}
STR_1746 :No puedes cambiar esto…
@@ -1161,17 +1163,6 @@ STR_1773 :Sólo se permite una sección de fotos por atracción.
STR_1774 :Sólo un cable de elevación por atracción.
STR_1777 :Música de atracción
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Disfraz de panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Disfraz de tigre
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Disfraz de elefante
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Disfraz de romano
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Disfraz de gorila
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Disfraz de muñeco de nieve
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Disfraz de caballero
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Disfraz de astronauta
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Disfraz de bandido
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Disfraz de sheriff
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Disfraz de pirata
STR_1790 :Selecciona el color del uniforme para este tipo de empleados
STR_1791 :{WINDOW_COLOUR_2}Color del uniforme:
STR_1792 :Dirigiéndose a {STRINGID}
@@ -1665,11 +1656,11 @@ STR_2301 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} gastados en {BLACK}{COMMA16}
STR_2302 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} gastados en {BLACK}{COMMA16} refrescos
STR_2303 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} gastados en {BLACK}{COMMA16} souvenir
STR_2304 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} gastados en {BLACK}{COMMA16} souvenirs
-STR_2305 :Archivos Diseño Vía
-STR_2306 :Guardar Diseño Vía
-STR_2307 :Selecciona diseño de {STRINGID}
+STR_2305 :Archivos de diseño de vía
+STR_2306 :Guardar diseño de vía
+STR_2307 :Selecciona diseño {STRINGID}
STR_2308 :{STRINGID} Diseños de Vía
-STR_2309 :Instalar Diseño de Vía
+STR_2309 :Instalar nuevo Diseño de Vía
STR_2310 :Construir diseño personalizado
STR_2311 :{WINDOW_COLOUR_2}Nivel de emoción: {BLACK}{COMMA2DP32} (aprox.)
STR_2312 :{WINDOW_COLOUR_2}Nivel de intensidad: {BLACK}{COMMA2DP32} (aprox.)
@@ -1910,9 +1901,9 @@ STR_2669 :NumLock
STR_2670 :Scroll
STR_2680 :Investigación Completa
STR_2684 :Llega un gran grupo de visitantes
-STR_2685 :Simplex Noise Parameters
-STR_2686 :Bajo:
-STR_2687 :Alto:
+STR_2685 :Parámetros del Ruido "Simplex"
+STR_2686 :Altura mín. terreno:
+STR_2687 :Altura máx. terreno:
STR_2688 :Frecuencia Base:
STR_2689 :Octavas:
STR_2690 :Generación Mapa
@@ -2050,9 +2041,9 @@ STR_2846 :{TOPAZ}¡Tu parque ha recibido el premio a ‘El parque con la disp
STR_2847 :{TOPAZ}¡Tu parque ha recibido el premio a ‘El parque con las mejores atracciones suaves’!
STR_2848 :{WINDOW_COLOUR_2}Sin premios recientes
STR_2849 :Nuevo escenario instalado exitosamente
-STR_2850 :Nueva vía instalada exitosamente
+STR_2850 :Nuevo diseño de vía instalado exitosamente
STR_2851 :Escenario ya instalado
-STR_2852 :Vía ya instalada
+STR_2852 :Diseño de vía ya instalada
STR_2853 :¡Prohibido por las autoridades locales!
STR_2854 :{RED}¡Los visitantes no encuentran la entrada de {STRINGID}!{NEWLINE}Construye un sendero hacia la entrada
STR_2855 :{RED}¡{STRINGID} no tiene un sendero de salida!{NEWLINE}Construye un sendero desde la salida de la atracción.
@@ -2169,7 +2160,7 @@ STR_3128 :Guardar diseño de vía
STR_3129 :Guardar diseño de vía con decorado
STR_3130 :Guardar
STR_3131 :Cancelar
-STR_3132 :{BLACK}Clic en elementos de escenario para guardar junto con el diseño de la vía …
+STR_3132 :{BLACK}Clic en elementos de escenario para guardar junto con el diseño de vía…
STR_3133 :No es posible construir esto en una pendiente
STR_3134 :{RED}(Este diseño incluye un decorado que no está disponible)
STR_3135 :{RED}(Vehículo no disponible - El rendimiento puede verse afectado)
@@ -2223,8 +2214,8 @@ STR_3203 :Lista de inventos finalizada
STR_3204 :Elección de opciones
STR_3205 :Selección de objetivos
STR_3206 :Guardar Escenario
-STR_3207 :Diseñador de Montañas Rusas
-STR_3208 :Diseñador de Vías
+STR_3207 :Diseñador de Vías
+STR_3208 :Gestor de diseños de vías
STR_3209 :Regresar al paso anterior:
STR_3210 :Avanzar al siguiente paso:
STR_3211 :Tamaño de Mapa:
@@ -2349,7 +2340,7 @@ STR_3332 :La entrada del parque está al revés o no tiene un sendero que lle
STR_3333 :Exportar complementos al guardar el juego
STR_3334 :Selecciona si los complementos adicionales (datos no distribuidos con el juego principal) utilizados en un escenario deben exportarse al guardar el juego, lo que permite que otros jugadores que no tengan esos complementos puedan abrirlo.
STR_3335 :Diseñador de Vías - Selecciona el tipo de Atracción y Vehículo
-STR_3336 :Gestor de Diseños de vías - Elige tipo de atracción
+STR_3336 :Gestor de Diseños de Vías - Elige tipo de atracción
STR_3338 :{BLACK}Recorrido personalizado
STR_3339 :{BLACK}{COMMA16} diseño disponible, o recorrido personalizado
STR_3340 :{BLACK}{COMMA16} diseños disponibles, o recorrido personalizado
@@ -2357,13 +2348,13 @@ STR_3341 :Herramientas de juego
STR_3342 :Editor de escenarios
STR_3343 :Convertir partida guardada en escenario
STR_3344 :Diseñador de Vías
-STR_3345 :Administrador de Vías
+STR_3345 :Gestor de Diseños de Vías
STR_3346 :No se puede guardar el diseño de vía…
-STR_3347 :Atracc. demasiada larga, contiene demasiados elementos, o el paisaje está demasiado lejos.
+STR_3347 :Atracc. demasiado grande, contiene demasiados elementos, o el decorado está demasiado separado
STR_3348 :Renombrar
STR_3349 :Borrar
-STR_3350 :Nombrar Diseño Vía
-STR_3351 :Nuevo nombre de diseño de vía:
+STR_3350 :Nombre del Diseño de Vía
+STR_3351 :Nuevo nombre para el diseño de vía:
STR_3352 :No se puede renombrar el diseño de vía…
STR_3353 :El nuevo nombre contiene caracteres inválidos
STR_3354 :Otro archivo ya tiene este nombre o se encuentra protegido contra escritura
@@ -2371,9 +2362,9 @@ STR_3355 :El archivo está bloqueado o protegido contra escritura
STR_3356 :Borrar Archivo
STR_3357 :{WINDOW_COLOUR_2}¿Estás seguro de borrar permanentemente {STRING} ?
STR_3358 :No se puede eliminar el diseño da vía…
-STR_3359 :{BLACK}Sin diseños de vías para esta atracción
+STR_3359 :{BLACK}Sin diseños de vía de este tipo
STR_3360 :¡Advertencia!
-STR_3361 :Demasiados diseños de vía - Algunos no se listarán.
+STR_3361 :Demasiados diseños de vía de este tipo. Algunos no serán listados.
STR_3364 :Avanzado
STR_3365 :Permitir la selección de escenario además de grupos de escenarios.
STR_3366 :{BLACK}= Atracción
@@ -2393,8 +2384,8 @@ STR_3379 :Cancelar
STR_3380 :No se pudo instalar este diseño de vía…
STR_3381 :Archivo no compatible o contiene datos inválidos
STR_3382 :Copia de archivo fallada
-STR_3383 :Selecc. nuevo nombre diseño de vía
-STR_3384 :Un diseño de vía ya tiene este nombre - escoge otro nombre:
+STR_3383 :Selecciona un nombre nuevo para el diseño de vía
+STR_3384 :Ya existe un diseño de vía con este nombre. Por favor, usa un nombre nuevo:
STR_3389 :No es posible seleccionar el elemento adicional de escenario…
STR_3390 :Demasiados elementos seleccionados
# Start of tutorial strings. Not used at the moment, so not necessary to translate.
@@ -2471,9 +2462,9 @@ STR_5196 :Derechos de construcción
STR_5197 :Escenario
STR_5198 :Sendero
STR_5199 :Construcción de Atracción
-STR_5200 :Editor de Vías
+STR_5200 :Localización de Diseño de Vía
STR_5201 :Nueva atracción
-STR_5202 :Selección Editor de Vías
+STR_5202 :Selección de Diseño de Vía
STR_5203 :Atracciones
STR_5204 :Lista de Atracciones
STR_5205 :Visitante
@@ -2486,8 +2477,8 @@ STR_5211 :Lista de Inventos
STR_5212 :Opciones de Escenario
STR_5213 :Opciones de Objetivos
STR_5214 :Generación de Mapa
-STR_5215 :Gestor de Diseño de Vías
-STR_5216 :Gestor de Listado de Diseños de Vías
+STR_5215 :Gestor de Diseño de Vía
+STR_5216 :Listado de Gestor de Diseño de Vía
STR_5217 :Trucos
STR_5218 :Temas
STR_5219 :Opciones
@@ -2579,8 +2570,8 @@ STR_5309 :OpenRCT2
STR_5310 :Aleatorio
STR_5311 :Herramientas de depuración
STR_5312 :Mostrar consola
-STR_5313 :Mostrar inspc. cuadricula
-STR_5314 :Inspector de cuadricula
+STR_5313 :Mostrar inspc. cuadrícula
+STR_5314 :Inspector de cuadrícula
STR_5335 :Entrada
STR_5336 :Salida
STR_5337 :Entrada del Parque
@@ -2595,7 +2586,7 @@ STR_5347 :Trucos del parque
STR_5348 :Trucos de atracciones
STR_5349 :Todas las atracciones
STR_5350 :Máx.
-STR_5351 :Min.
+STR_5351 :Mín.
STR_5352 :{BLACK}Felicidad:
STR_5353 :{BLACK}Energía:
STR_5354 :{BLACK}Hambre:
@@ -2783,7 +2774,7 @@ STR_5612 :Bandera Fantasma
STR_5613 :B
STR_5614 :Bandera Roto
STR_5615 :L
-STR_5616 :Último elemento para bandera de cuadricula.
+STR_5616 :Último elemento para bandera de cuadrícula.
STR_5617 :Mover elementos selec. arriba.
STR_5618 :Mover elementos selec. abajo.
#Estas líneas son en inglés
@@ -3098,7 +3089,7 @@ STR_5970 :ID Entrada: {BLACK}{COMMA16}
STR_5971 :ID Salida: {BLACK}{COMMA16}
STR_5972 :ID Atracción: {BLACK}{COMMA16}
STR_5973 :Sujetar al siguiente
-STR_5974 :Cambia la altura base y de gálibo, de modo que sea la misma que el siguiente elemento en el cuadrado actual. Esto hace que sea más fácil de construir en esta cuadricula.
+STR_5974 :Cambia la altura base y de gálibo, de modo que sea la misma que el siguiente elemento en el cuadrado actual. Esto hace que sea más fácil de construir en esta cuadrícula.
STR_5975 :Pendiente:
STR_5976 :Plano
STR_5977 :Lado derecho hacia arriba
@@ -3140,7 +3131,7 @@ STR_6012 :{COMMA1DP16}
STR_6013 :Los visitantes sólo pagarán por la entrada del parque y los servicios.{NEWLINE}La entrada de la atracción es gratis.
STR_6014 :Los visitantes sólo pagarán por la entrada de atracciones y servicios.{NEWLINE}Los visitantes no pagan por entrar al parque.
STR_6015 :Inclinado
-STR_6016 :Modificar Cuadricula
+STR_6016 :Modificar Cuadrícula
STR_6017 :Por favor más despacio
STR_6018 :Construir Atrac. - Curva Izquierda
STR_6019 :Construir Atrac. - Curva Derecha
@@ -3169,16 +3160,16 @@ STR_6041 :{BLACK}¡No hay mecánicos contratados!
STR_6042 :Cargar mapa de altura
STR_6043 :Seleccionar mapa de altura
STR_6044 :Suavizar mapa de altura
-STR_6045 :Intensidad
+STR_6045 :Intensidad:
STR_6046 :Normalizar mapa de altura
-STR_6047 :Suavizar cuadricula
+STR_6047 :Suavizar bordes de cuadrícula
STR_6048 :Error de mapa de altura
STR_6049 :Error al leer PNG
STR_6050 :Error al leer bitmap
-STR_6052 :El mapa de altura es muy grande, será cortado.
-STR_6053 :El mapa de altura no puede ser normalizado.
+STR_6052 :El mapa de alturas es muy grande, será cortado
+STR_6053 :El mapa de alturas no puede ser normalizado
STR_6054 :Sólo bitmaps de 24-bits son soportados
-STR_6055 :Mapa de altura de OpenRCT2
+STR_6055 :Mapa de alturas de OpenRCT2
STR_6056 :Silenciar
STR_6057 :Mostrar un botón separado para la Opción ‘Silenciar’ en la barra de herramientas.
STR_6058 :Silenciar
@@ -3569,10 +3560,10 @@ STR_6493 :Este parque fue guardado en una versión más reciente de OpenRCT2,
STR_6494 :Agrupar por tipo de atracción
STR_6495 :Agrupar las atracciones por tipo en vez de mostrar cada vehículo por separado.
STR_6496 :{WINDOW_COLOUR_2}{STRINGID}
-STR_6497 :Haz click en una casilla para mostrar sus elementos.{NEWLINE}Ctrl + click un elemento para seleccionarlo directamente.
+STR_6497 :Haz clic en una casilla para mostrar sus elementos.{NEWLINE}Ctrl + clic un elemento para seleccionarlo directamente.
STR_6498 :Activa para mantener el mapa con forma cuadrada.
-STR_6499 :Tipo de vehículo no compatible con el formato de diseño de la vía
-STR_6500 :Elementos no compatibles con el formato de diseño de la vía
+STR_6499 :Tipo de vehículo no compatible con el formato del diseño de vía
+STR_6500 :Elementos no compatibles con el formato del diseño de vía
STR_6501 :Color aleatorio
STR_6502 :Introduce un valor entre {COMMA16} y {COMMA16}
STR_6503 :Al menos un objeto de estación debe estar seleccionado
@@ -3590,7 +3581,7 @@ STR_6514 :¡Altura no válida!
STR_6515 :{BLACK}RollerCoaster Tycoon 1 no ha sido enlazado - se utilizarán imágenes alternativas.
STR_6516 :Uno o más objetos añadidos requieren haber enlazado RollerCoaster Tycoon 1 para su correcta visualización. Se utilizarán imágenes alternativas.
STR_6517 :Uno o más objetos de este parque requieren haber enlazado RollerCoaster Tycoon 1 para su correcta visualización. Se utilizarán imágenes alternativas.
-STR_6518 :{BLACK}Posa el ratón sobre un escenario para ver su descripción y objetivos. Haz click para empezar a jugar.
+STR_6518 :{BLACK}Posa el ratón sobre un escenario para ver su descripción y objetivos. Haz clic para empezar a jugar.
STR_6519 :Extras
STR_6520 :Paquetes de Recursos
STR_6521 :Prioridad baja
@@ -3613,7 +3604,7 @@ STR_6537 :Permitir usar senderos normales como cola
STR_6538 :Muestra senderos normales en el menú desplegable de colas de la ventana Senderos.
STR_6539 :Freno cerrado
STR_6540 :{WINDOW_COLOUR_2}En especial gracias a las siguientes empresas for permitir el uso de su imagen:
-STR_6541 :{WINDOW_COLOUR_2}Rocky Mountain Construction Group, Josef Wiegand GmbH & Co. KG
+STR_6541 :{WINDOW_COLOUR_2}Rocky Mountain Construction Group, Josef Wiegand GmbH & Co. KG, Intamin Amusement Rides Int. Corp. Est.
STR_6542 :Colaboradores
STR_6543 :Colaboradores…
STR_6544 :¡El préstamo no puede ser negativo!
@@ -3666,7 +3657,7 @@ STR_6590 :Mostrar los botones de ventana (como el de cerrar la ventana) a la
STR_6591 :El empleado está reparando una atracción y no puede ser despedido.
STR_6592 :El empleado está inspeccionando una atracción y no puede ser despedido.
STR_6593 :Eliminar vallas del parque
-STR_6594 :Inspector de cuadricula: Alternar inclinación del muro
+STR_6594 :Inspector de cuadrícula: Alternar inclinación del muro
STR_6595 :{WINDOW_COLOUR_2}Autor: {BLACK}{STRING}
STR_6596 :{WINDOW_COLOUR_2}Autores: {BLACK}{STRING}
STR_6597 :Parámetro no válido
@@ -3749,3 +3740,36 @@ STR_6673 :Translúcido
STR_6674 :{MONTH}, Año {COMMA16}
STR_6675 :Nombres de Personitas
STR_6676 :Se debe seleccionar al menos un objeto de nombre de personita
+STR_6677 :Agregar playas alrededor de cuerpos de agua
+STR_6678 :Fuente del mapa de alturas:
+STR_6679 :Terreno plano
+STR_6680 :Ruido "Simplex"
+STR_6681 :Archivo de mapa de alturas
+STR_6682 :Generador de mapa - Generador
+STR_6683 :Generador de mapa - Terreno
+STR_6684 :Generador de mapa - Agua
+STR_6685 :Generador de mapa - Bosques
+STR_6686 :Relación árboles-terreno:
+STR_6687 :Altura mín. árboles:
+STR_6688 :Altura máx. árboles:
+STR_6689 :{UINT16}%
+STR_6690 :Altura mínima del terreno
+STR_6691 :Introduce una altura mínima del terreno entre {COMMA16} y {COMMA16}
+STR_6692 :Altura máxima del terreno
+STR_6693 :Introduce una altura máxima del terreno entre {COMMA16} y {COMMA16}
+STR_6694 :Altura mínima de los árboles
+STR_6695 :Introduce una altura mínima de árboles entre {COMMA16} y {COMMA16}
+STR_6696 :Altura máxima de los árboles
+STR_6697 :Introduce una altura máxima de árboles entre {COMMA16} y {COMMA16}
+STR_6698 :Relación árboles-terreno
+STR_6699 :Introduce una relación árboles-terreno entre {COMMA16} y {COMMA16}
+STR_6700 :Frecuencia Base del Ruido "Simplex"
+STR_6701 :Introduce una Frecuencia Base entre {COMMA2DP32} y {COMMA2DP32}
+STR_6702 :Octavas del Ruido "Simplex"
+STR_6703 :Introduce Octavas entre {COMMA16} y {COMMA16}
+STR_6704 :{COMMA2DP32}
+STR_6705 :Examinar…
+STR_6706 :{WINDOW_COLOUR_2}Archivo de imagen actual: {BLACK}{STRING}
+STR_6707 :(ninguno seleccionado)
+STR_6708 :Fuerza de Suavizado
+STR_6709 :Introduce una Fuerza de Suavizado entre {COMMA16} y {COMMA16}
diff --git a/data/language/fi-FI.txt b/data/language/fi-FI.txt
index 9314d9385c..72765c10fa 100644
--- a/data/language/fi-FI.txt
+++ b/data/language/fi-FI.txt
@@ -1164,17 +1164,6 @@ STR_1773 :Vain yksi valokuvaosio sallittu per laite
STR_1774 :Vain yksi nostomäki sallittu per laite
STR_1777 :{WINDOW_COLOUR_2}Musiikki
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Pandapuku
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiikeripuku
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Norsupuku
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Roomalaispuku
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorillapuku
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Lumimiespuku
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Ritaripuku
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronauttipuku
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Rosvopuku
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Seriffipuku
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Merirosvopuku
STR_1790 :Valitse virka-asun väri tälle henkilöstötyypille
STR_1791 :{WINDOW_COLOUR_2}Virka-asun väri:
STR_1792 :Matkalla korjaamaan laitetta {STRINGID}
diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt
index 7819a321a0..0dd9ee5685 100644
--- a/data/language/fr-FR.txt
+++ b/data/language/fr-FR.txt
@@ -1169,17 +1169,6 @@ STR_1773 :Une seule section photo sur le vif autorisée par attraction
STR_1774 :Une seule remontée à chaîne autorisée par attraction
STR_1777 :Musique de l’attraction
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Costume de panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Costume de tigre
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Costume d’éléphant
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Costume romain
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Costume de gorille
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Costume de bonhomme de neige
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Costume de chevalier
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Costume d’astronaute
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Costume de bandit
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Costume de shérif
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Costume de pirate
STR_1790 :Sélectionnez la couleur de l’uniforme pour ce type d’employé
STR_1791 :{WINDOW_COLOUR_2}Couleur d’uniforme :
STR_1792 :Va réparer {STRINGID}
@@ -2187,7 +2176,6 @@ STR_3136 :Attention : cette construction sera fabriquée avec un autre type
STR_3137 :Choisir décor proche
STR_3138 :Recomm. sélection
STR_3139 :Impossible d’appliquer une remontée à chaîne dans ce mode de fonctionnement
-STR_3140 :La remontée à chaîne doit commencer immédiatement à la sortie de la station
STR_3141 :La remontée à chaîne n’est pas compatible avec une attraction multi-parcours
STR_3142 :{WINDOW_COLOUR_2}Capacité : {BLACK}{STRINGID}
STR_3143 :Voir les personnes sur la carte
@@ -2219,7 +2207,7 @@ STR_3188 :Panneaux de direction
STR_3189 :Allées classiques
STR_3190 :Suppléments allées
STR_3191 :Groupes de décor
-STR_3192 :Entrée du parc
+STR_3192 :Entrées du parc
STR_3193 :Etendue d’eau
STR_3195 :Liste d’inventions
STR_3196 :{WINDOW_COLOUR_2}Groupe de recherche : {BLACK}{STRINGID}
@@ -2626,7 +2614,7 @@ STR_5368 :Réinit. accidents
STR_5371 :Sélection d’objets
STR_5372 :Inverser le déplacement du clic droit
STR_5373 :Nom {STRINGID}
-STR_5374 :Date {STRINGID}
+STR_5374 :Date de modification {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Le nom existe déjà
@@ -3792,3 +3780,23 @@ STR_6707 :(aucun sélectionné)
STR_6708 :Puissance du lissage
STR_6709 :Entrez une puissance du lissage comprise entre {COMMA16} et {COMMA16}
STR_6710 :Tri stable
+STR_6711 :Nom de fichier :
+STR_6712 :Enregistrer
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Nom de fichier
+STR_6715 :Date de modification
+STR_6716 :Taille
+STR_6717 :Taille {STRINGID}
+STR_6718 :Animations de personnel
+STR_6719 :Au moins un objet d’animations de personnel doit être sélectionné
+STR_6720 :Au moins un objet d’animations d’agent d’entretien doit être sélectionné
+STR_6721 :Au moins un objet d’animations de mécanicien doit être sélectionné
+STR_6722 :Au moins un objet d’animations d’agent de sécurité doit être sélectionné
+STR_6723 :Au moins un objet d’animations d’animateur doit être sélectionné
+STR_6724 :Textes de scénario
+STR_6725 :X :
+STR_6726 :Y :
+STR_6727 :Boucle plongeante (gauche)
+STR_6728 :Boucle plongeante (droite)
+STR_6729 :La remontée à chaîne doit commencer immédiatement à la sortie de la station ou des freins de bloc
+
diff --git a/data/language/gl-ES.txt b/data/language/gl-ES.txt
index a66770ec53..2082b97e22 100644
--- a/data/language/gl-ES.txt
+++ b/data/language/gl-ES.txt
@@ -1164,17 +1164,6 @@ STR_1773 :Só se permite unha sección de fotos por atracción.
STR_1774 :Só un cable de elevación por atracción.
STR_1777 :Música de atracción
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Traxe de panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Traxe de tigre
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Traxe de elefante
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Traxe romano
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Traxe de gorila
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Traxe de boneco de neve
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Traxe de cabaleiro
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Traxe de astronauta
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Traxe de bandido
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Traxe de shériff
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Traxe de pirata
STR_1790 :Seleccione a cor do uniforme para este tipo de empregados
STR_1791 :{WINDOW_COLOUR_2}Cor uniforme:
STR_1792 :enderezo {STRINGID}
@@ -2180,7 +2169,7 @@ STR_3136 :Advertencia: este aspecto crearase cun tipo de vehículo alternativ
STR_3137 :Seleccionar. Escenario próximo
STR_3138 :Restablecer selección.
STR_3139 :O cable de elevación non pode funcionar neste modo
-STR_3140 :O cable do ascensor debería comezar despois da estación
+STR_3140 :O cable do telecadeira debe comezar inmediatamente despois da estación
STR_3141 :Multicircuíto por atracción. non é posible cun cable de elevación
STR_3142 :{WINDOW_COLOUR_2}Capacidade: {BLACK}{STRINGID}
STR_3143 :Mostrar visitantes no mapa
@@ -2212,7 +2201,7 @@ STR_3188 :Sinais de camiños
STR_3189 :Rutas antigas
STR_3190 :Decoración de sendeiros
STR_3191 :Escenarios
-STR_3192 :Entrada do parque
+STR_3192 :Entradas do parque
STR_3193 :Auga
STR_3195 :Lista de inventos
STR_3196 :{WINDOW_COLOUR_2}Grupo de investigación: {BLACK}{STRINGID}
@@ -2617,7 +2606,7 @@ STR_5368 :Restablecer accidentes
STR_5371 :Selección de obxectos
STR_5372 :Inverte a compensación do clic dereito
STR_5373 :Nome {STRINGID}
-STR_5374 :Data {STRINGID}
+STR_5374 :Data de modificación {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :O nome xa existe
@@ -3784,3 +3773,20 @@ STR_6707 :(Ningún escollido)
STR_6708 :Intensidade de suavizado
STR_6709 :Introduce a intensidade de suavizado entre {COMMA16} e {COMMA16}
STR_6710 :Ordenación estable
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Nome do ficheiro
+STR_6715 :Data de modificación
+STR_6716 :Tamaño do ficheiro
+STR_6717 :Tamaño do ficheiro {STRINGID}
+STR_6718 :Animacións de personaxes
+STR_6719 :Debe seleccionarse polo menos un obxecto de animacións de personaxes invitados
+STR_6720 :Debe seleccionarse polo menos un obxecto de animacións de personaxes de operario
+STR_6721 :Debe seleccionarse polo menos un obxecto de animacións de personaxes de mecánico
+STR_6722 :Debe seleccionarse polo menos un obxecto de animacións de personaxes de seguridade
+STR_6723 :Debe seleccionarse polo menos un obxecto de animacións de personaxes de animador
+STR_6724 :Textos do escenario
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :Bucle de mergullo (esquerda)
+STR_6728 :Loop de mergullo (dereita)
+STR_6729 :A subida da telecadeira debe comezar inmediatamente despois da estación ou do freno de bloqueo
diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt
index 94f9869862..8dbab5b75e 100644
--- a/data/language/hu-HU.txt
+++ b/data/language/hu-HU.txt
@@ -1160,17 +1160,6 @@ STR_1773 :Csak egy élményfotó-szakasz engedélyezett játékonként
STR_1774 :Csak egy kábeles felvonószakasz engedélyezett játékonként
STR_1777 :Játékok zenéje
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda jelmez
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tigris jelmez
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elefánt jelmez
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Római jelmez
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla jelmez
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Hóember jelmez
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Lovag jelmez
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Űrhajós jelmez
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandita jelmez
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Seriff jelmez
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Kalóz jelmez
STR_1790 :A választott típusú alkalmazottak által viselt egyenruha színének kiválasztása
STR_1791 :{WINDOW_COLOUR_2}Egyenruha színe:
STR_1792 :{STRINGID} segélykérésére válaszol
diff --git a/data/language/it-IT.txt b/data/language/it-IT.txt
index f435208bb7..4e23cfff5f 100644
--- a/data/language/it-IT.txt
+++ b/data/language/it-IT.txt
@@ -1163,17 +1163,6 @@ STR_1773 :Può esserci soltanto una sezione di foto-in-corsa per attrazione
STR_1774 :Può esserci soltanto una salita per il traino con cavo per attrazione
STR_1777 :Musica attrazioni
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Costume da panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Costume da tigre
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Costume da elefante
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Costume da antico romano
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Costume da gorilla
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Costume da pupazzo di neve
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Costume da cavaliere
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Costume da astronauta
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Costume da bandito
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Costume da sceriffo
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Costume da pirata
STR_1790 :Scegli il colore dell’uniforme per questo tipo di dipendente
STR_1791 :{WINDOW_COLOUR_2}Colore dell’uniforme:
STR_1792 :Sta accorrendo al guasto di {STRINGID}
diff --git a/data/language/ja-JP.txt b/data/language/ja-JP.txt
index 3b3ca8f451..2c775ca02c 100644
--- a/data/language/ja-JP.txt
+++ b/data/language/ja-JP.txt
@@ -1160,17 +1160,6 @@ STR_1773 :乗物からの写真の場所は、各乗物につき一箇所だ
STR_1774 :ケーブルリフトヒルは、各乗物につき一箇所だけです
STR_1777 :音楽
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} パンダのコスチューム
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} トラのコスチューム
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} 象のコスチューム
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} ローマのコスチューム
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} ゴリラのコスチューム
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} 雪だるまのコスチューム
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} ナイトのコスチューム
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} 宇宙飛行士のコスチューム
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} 泥棒のコスチューム
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} シェリフのコスチューム
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} 海賊のコスチューム
STR_1790 :このスタッフのタイプの制服の色を選択:
STR_1791 :{WINDOW_COLOUR_2}制服の色:
STR_1792 :{STRINGID}の故障の電話を返事中
diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt
index 2ab5820fcc..384f6cc604 100644
--- a/data/language/ko-KR.txt
+++ b/data/language/ko-KR.txt
@@ -1166,17 +1166,6 @@ STR_1773 :한 놀이기구에는 하나의 탑승 사진 섹션만 만들 수
STR_1774 :한 놀이기구에는 하나의 케이블 리프트만 만들 수 있습니다
STR_1777 :놀이기구 음악
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} 판다 복장
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} 호랑이 복장
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} 코끼리 복장
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} 로마 전사 복장
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} 고릴라 복장
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} 눈사람 복장
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} 기사 복장
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} 우주비행사 복장
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} 산적 복장
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} 보안관 복장
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} 해적 복장
STR_1790 :이 직종의 유니폼 색상을 선택하세요
STR_1791 :{WINDOW_COLOUR_2}유니폼 색상:
STR_1792 :{STRINGID} 고장 연락을 받음
@@ -2184,7 +2173,6 @@ STR_3136 :경고: 다른 차량 종류로 대체되어 지어질 것이며
STR_3137 :근처 조형물 선택
STR_3138 :선택 초기화
STR_3139 :이 운행 모드에서는 케이블 리프트 힐을 작동할 수 없습니다
-STR_3140 :케이블 리프트 힐은 탑승장 바로 다음에 건설해야 합니다
STR_3141 :케이블 리프트 힐을 사용하면 2바퀴 이상 차량을 운용할 수 없습니다
STR_3142 :{WINDOW_COLOUR_2}수용량: {BLACK}{STRINGID}
STR_3143 :손님을 지도에 표시합니다
@@ -2621,7 +2609,7 @@ STR_5368 :충돌 이력 제거
STR_5371 :오브젝트 선택
STR_5372 :마우스 오른쪽 드래그 시 좌우 반전
STR_5373 :이름 {STRINGID}
-STR_5374 :날짜 {STRINGID}
+STR_5374 :수정 날짜 {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :이미 존재하는 이름입니다
@@ -3517,9 +3505,9 @@ STR_6437 :보이기
STR_6438 :{MOVE_X}{2}👁
STR_6439 :칸 조사 창: 감춤 여부
STR_6440 :물 투명하게 보기
-STR_6441 :최소 하나 이상의 일반 보도 바닥 오브젝트를 선택해야 합니다.
-STR_6442 :최소 하나 이상의 대기 줄 보도 바닥 오브젝트를 선택해야 합니다.
-STR_6443 :최소 하나 이상의 보도 난간 오브젝트를 선택해야 합니다.
+STR_6441 :최소 하나 이상의 일반 보도 바닥 오브젝트를 선택해야 합니다
+STR_6442 :최소 하나 이상의 대기 줄 보도 바닥 오브젝트를 선택해야 합니다
+STR_6443 :최소 하나 이상의 보도 난간 오브젝트를 선택해야 합니다
STR_6444 :보도 바닥
STR_6445 :보도 난간
STR_6446 :{WINDOW_COLOUR_2}바닥 이름: {BLACK}{STRINGID}
@@ -3786,3 +3774,25 @@ STR_6707 :(선택 안 함)
STR_6708 :부드러움 강도
STR_6709 :부드러움 강도를 {COMMA16}∼{COMMA16} 사이의 값으로 입력하세요
STR_6710 :안정된 정렬
+STR_6711 :파일 이름:
+STR_6712 :저장
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :파일 이름
+STR_6715 :수정 날짜
+STR_6716 :파일 크기
+STR_6717 :파일 크기 {STRINGID}
+STR_6718 :손님 애니메이션
+STR_6719 :최소 하나 이상의 손님 애니메이션 오브젝트를 선택해야 합니다
+STR_6720 :최소 하나 이상의 미화원 애니메이션 오브젝트를 선택해야 합니다
+STR_6721 :최소 하나 이상의 정비기술자 애니메이션 오브젝트를 선택해야 합니다
+STR_6722 :최소 하나 이상의 경비원 애니메이션 오브젝트를 선택해야 합니다
+STR_6723 :최소 하나 이상의 엔터테이너 애니메이션 오브젝트를 선택해야 합니다
+STR_6724 :시나리오 텍스트
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :다이브 루프 (왼쪽)
+STR_6728 :다이브 루프 (오른쪽)
+STR_6729 :케이블 리프트 힐은 탑승장이나 블록 브레이크 바로 다음에 건설해야 합니다
+STR_6730 :emscripten 데이터 내보내기
+STR_6731 :emscripten 데이터 가져오기
+STR_6732 :게임 화면을 시계반대방향으로 90° 회전하기
diff --git a/data/language/nb-NO.txt b/data/language/nb-NO.txt
index 4351df4a82..758c851d5f 100644
--- a/data/language/nb-NO.txt
+++ b/data/language/nb-NO.txt
@@ -1158,17 +1158,6 @@ STR_1773 :Kun én fotoseksjon tillatt per bane
STR_1774 :Kun ett kabeltrekk tillatt per bane
STR_1777 :Attraksjonsmusikk
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda-kostyme
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiger-kostyme
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elefant-kostyme
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Romer-kostyme
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla-kostyme
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snømann-kostyme
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Ridder-kostyme
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaut-kostyme
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Banditt-kostyme
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriff-kostyme
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirat-kostyme
STR_1790 :Velg uniform-farge for denne typen personale
STR_1791 :{WINDOW_COLOUR_2}Uniform-farge:
STR_1792 :Svarer på {STRINGID} beskjed om sammenbrudd
diff --git a/data/language/nl-NL.txt b/data/language/nl-NL.txt
index ca4d6d36dd..7fc06eff97 100644
--- a/data/language/nl-NL.txt
+++ b/data/language/nl-NL.txt
@@ -1163,17 +1163,6 @@ STR_1773 :Een attractie mag maar één actiefotogedeelte hebben
STR_1774 :Een attractie mag maar één kabellift hebben
STR_1777 :Attractiemuziek
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Pandapak
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tijgerpak
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Olifantenpak
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Romeins kostuum
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorillapak
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Sneeuwpoppak
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Ridderkostuum
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronautenpak
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandietenkostuum
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriffkostuum
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Piratenkostuum
STR_1790 :Selecteer de uniformkleur voor dit type werknemer
STR_1791 :{WINDOW_COLOUR_2}Uniformkleur:
STR_1792 :Gaat {STRINGID} repareren
@@ -2179,7 +2168,6 @@ STR_3136 :Waarschuwing: Dit ontwerp zal worden gebouwd met een ander type kar
STR_3137 :Decor naast baan selecteren
STR_3138 :Alles deselecteren
STR_3139 :Kabellift kan niet functioneren in deze werkmodus
-STR_3140 :Kabellift moet meteen na het station beginnen
STR_3141 :Meerdere circuits zijn niet mogelijk met een kabellift
STR_3142 :{WINDOW_COLOUR_2}Capaciteit: {BLACK}{STRINGID}
STR_3143 :Laat bezoekers zien op kaart
@@ -2211,7 +2199,7 @@ STR_3188 :Lichtkranten
STR_3189 :Voetpaden (oude stijl)
STR_3190 :Extra’s voor paden
STR_3191 :Decorgroepen
-STR_3192 :Parkingang
+STR_3192 :Parkingangen
STR_3193 :Water
STR_3195 :Lijst van uitvindingen
STR_3196 :{WINDOW_COLOUR_2}Onderzoeksgroep: {BLACK}{STRINGID}
@@ -2618,7 +2606,7 @@ STR_5368 :Crashstatus weg
STR_5371 :Objectselectie
STR_5372 :Sleeprichting van rechtermuisknop omkeren
STR_5373 :Naam {STRINGID}
-STR_5374 :Datum {STRINGID}
+STR_5374 :Gewijzigd {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Naam bestaat al
@@ -3784,3 +3772,23 @@ STR_6709 :Voer een afrondsterkte in tussen {COMMA16} en {COMMA16}
STR_6710 :Stabiel sorteren
STR_6711 :Bestandsnaam:
STR_6712 :Opslaan
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Naam
+STR_6715 :Gewijzigd
+STR_6716 :Grootte
+STR_6717 :Grootte {STRINGID}
+STR_6718 :NPC-animaties
+STR_6719 :Er moet minstens één object met bezoekersanimaties geselecteerd zijn.
+STR_6720 :Er moet minstens één object met klusjesmananimaties geselecteerd zijn.
+STR_6721 :Er moet minstens één object met monteuranimaties geselecteerd zijn.
+STR_6722 :Er moet minstens één object met bewakeranimaties geselecteerd zijn.
+STR_6723 :Er moet minstens één object met entertaineranimaties geselecteerd zijn.
+STR_6724 :Scenariobeschrijvingen
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :Dive loop (links)
+STR_6728 :Dive loop (rechts)
+STR_6729 :Kabellift moet meteen na het station of een blokrem beginnen.
+STR_6730 :Emscripten-data exporteren
+STR_6731 :Emscripten-data importeren
+STR_6732 :Toon een knop in de werkbalk om het beeld tegen de klok in te draaien.
diff --git a/data/language/pl-PL.txt b/data/language/pl-PL.txt
index 5c5505eee8..ab857fbcab 100644
--- a/data/language/pl-PL.txt
+++ b/data/language/pl-PL.txt
@@ -1093,7 +1093,7 @@ STR_1698 :Można to umieścić jedynie na ścieżce kolejki
STR_1699 :Za dużo ludzi w grze
STR_1700 :Zatrudnij dozorcę
STR_1701 :Zatrudnij mechanika
-STR_1702 :Zatrudnij ochroniarza
+STR_1702 :Zatrudnij strażnika
STR_1703 :Zatrudnij komika
STR_1704 :Nie można zatrudnić nowych pracowników…
STR_1705 :Zwolnij pracownika
@@ -1164,17 +1164,6 @@ STR_1773 :Tylko jedna sekcja fotograficzna dostępna na atrakcję
STR_1774 :Tylko jedna wyciągarka dostępna na atrakcję
STR_1777 :{WINDOW_COLOUR_2}Muzyka atrakcji
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Kostium pandy
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Kostium tygrysa
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Kostium słonia
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Kostium rzymianina
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Kostium goryla
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Kostium bałwana
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Kostium rycerza
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Kostium astronauty
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Kostium bandyty
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Kostium szeryfa
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Kostium pirata
STR_1790 :Wybierz kolor uniformu dla tego typu pracownika
STR_1791 :{WINDOW_COLOUR_2}Kolor uniformu:
STR_1792 :Zmierza naprawić {STRINGID}
@@ -2011,7 +2000,7 @@ STR_2804 :Podświetl tych pracowników na mapie
STR_2805 :Pokaż plan parku
STR_2806 :{RED}Goście skarżą się na fatalny stan ścieżek w twoim parku{NEWLINE}Sprawdź gdzie znajdują się twoi dozorcy i rozważ lepszą organizacje ich pracy
STR_2807 :{RED}Goście skarżą się na śmieci leżące na ziemi w twoim parku{NEWLINE}Sprawdź gdzie znajdują się twoi dozorcy i rozważ lepszą organizację ich pracy
-STR_2808 :{RED}Goście skarzą się na wandalizm w twoim parku{NEWLINE}Sprawdź gdzie znajdują się twoi ochroniarze i rozważ poprawę organizacji ich pracy
+STR_2808 :{RED}Goście skarzą się na wandalizm w twoim parku{NEWLINE}Sprawdź gdzie znajdują się twoi strażnicy i rozważ poprawę organizacji ich pracy
STR_2809 :{RED}Goście są głodni i nie mogą znaleźć miejsca gdzie mogliby kupić coś do jedzenia
STR_2810 :{RED}Goście są spragnieni i nie mogą znaleźć miejsca gdzie mogliby kupić jakieś napoje
STR_2811 :{RED}Goście się skarżą, że w twoim parku bardzo ciężko jest znaleźć toaletę
@@ -2180,7 +2169,6 @@ STR_3136 :Uwaga: Ten projekt trasy będzie wybudowany z alternatywnymi wagona
STR_3137 :Wybierz najbliższą scenerię
STR_3138 :Zresetuj wybór
STR_3139 :Wyciągarka nie może działać w tym trybie
-STR_3140 :Wyciągarka musi znajdować się na początku trasy
STR_3141 :Wielokrotne pętle nie są dostępne w parze z wyciągarką
STR_3142 :{WINDOW_COLOUR_2}Pojemność: {BLACK}{STRINGID}
STR_3143 :Pokaż ludzi
@@ -2212,7 +2200,7 @@ STR_3188 :Znaki drogowe
STR_3189 :Klasyczne ścieżki
STR_3190 :Dodatki drogowe
STR_3191 :Grupa scenerii
-STR_3192 :Wejście do parku
+STR_3192 :Wejścia do parku
STR_3193 :Woda
STR_3195 :Lista wynalazków
STR_3196 :{WINDOW_COLOUR_2}Grupa badawcza: {BLACK}{STRINGID}
@@ -2617,7 +2605,7 @@ STR_5368 :Zresetuj wypadki
STR_5371 :Wybór obiektów
STR_5372 :Odwróć przeciąganie prawym przyciskiem myszy
STR_5373 :Nazwa {STRINGID}
-STR_5374 :Data {STRINGID}
+STR_5374 :Data modyfikacji {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Nazwa już istnieje
@@ -2634,8 +2622,8 @@ STR_5454 :Odblokuj FPS
STR_5455 :Włącz tryb piaskownicy
STR_5456 :Wyłącz sprawdzanie kolizji
STR_5457 :Wyłącz limity wsporników
-STR_5458 :Obróć zgodnie ze wskazówką zegara
-STR_5459 :Obróć odwrotnie względem wskazówki zegara
+STR_5458 :Obróć w prawo
+STR_5459 :Obróć w lewo
STR_5460 :Widok odwrotny względem wskazówki zegara
STR_5461 :Ustaw parametry dla wszystkich gości
STR_5462 :{CURRENCY}
@@ -3747,8 +3735,8 @@ STR_6671 :Pokazuj „prawdziwe” imiona pracowników
STR_6672 :Przełącz między pokazywaniem imion pracowników a numerami
STR_6673 :Przezroczyste
STR_6674 :{MONTH}, Rok {COMMA16}
-STR_6675 :Imiona gości
-STR_6676 :Co najmniej jeden obiekt z nazwami gości musi być wybrany
+STR_6675 :Imiona postaci
+STR_6676 :Należy wybrać co najmniej jeden obiekt z nazwami postaci
STR_6677 :Dodaj plaże wokół zbiorników wodnych
STR_6678 :Źródło mapy wysokości:
STR_6679 :Równina
@@ -3785,3 +3773,23 @@ STR_6709 :Wprowadź siłę wygładzania pomiędzy {COMMA16} a {COMMA16}:
STR_6710 :Włącz stabilne sortowanie
STR_6711 :Nazwa pliku:
STR_6712 :Zapisz
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Nazwa pliku
+STR_6715 :Data modyfikacji
+STR_6716 :Rozmiar pliku
+STR_6717 :Rozmiar {STRINGID}
+STR_6718 :Animacje postaci
+STR_6719 :Należy wybrać co najmniej jeden obiekt animacji gościa
+STR_6720 :Należy wybrać co najmniej jeden obiekt animacji dozorcy
+STR_6721 :Należy wybrać co najmniej jeden obiekt animacji mechanika
+STR_6722 :Należy wybrać co najmniej jeden obiekt animacji strażnika
+STR_6723 :Należy wybrać co najmniej jeden obiekt animacji komika
+STR_6724 :Teksty scenariuszy
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :Pętla nurkująca (w lewo)
+STR_6728 :Pętla nurkująca (w prawo)
+STR_6729 :Wyciągarka linowa musi znajdować się bezpośrednio po stacji lub hamulcu blokowym
+STR_6730 :Eksportuj dane emscripten
+STR_6731 :Importuj dane emscripten
+STR_6732 :Pokaż przycisk na pasku narzędzi do obracania widoku w kierunku przeciwnym do ruchu wskazówek zegara
diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt
index 2c0cc2571c..d6ac643c46 100644
--- a/data/language/pt-BR.txt
+++ b/data/language/pt-BR.txt
@@ -1164,17 +1164,6 @@ STR_1773 :Somente uma seção de fotos é permitida por atração
STR_1774 :Somente uma subida com cabo de elevação é permitida por atração
STR_1777 :Música da atração
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Fantasia de panda
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Fantasia de tigre
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Fantasia de elefante
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Fantasia de romano
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Fantasia de gorila
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Fantasia de boneco de neve
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Fantasia de cavaleiro
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Fantasia de astronauta
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Fantasia de bandido
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Fantasia de xerife
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Fantasia de pirata
STR_1790 :Selecione a cor do uniforme para este tipo de funcionário
STR_1791 :{WINDOW_COLOUR_2}Cor do uniforme:
STR_1792 :Respondendo a chamada de quebra da {STRINGID}
@@ -2180,7 +2169,6 @@ STR_3136 :Aviso: Este projeto será construído com um tipo alternativo de ve
STR_3137 :Selecionar Cenários Próximos
STR_3138 :Reiniciar Seleção
STR_3139 :Cabo de elevação não funciona neste modo de operação
-STR_3140 :Cabo de elevação deve estar imediatamente após a estação
STR_3141 :Várias voltas por ingresso não são possíveis com o cabo de elevação
STR_3142 :{WINDOW_COLOUR_2}Capacidade: {BLACK}{STRINGID}
STR_3143 :Mostrar pessoas no mapa
@@ -2212,7 +2200,7 @@ STR_3188 :Placa para Caminho
STR_3189 :Calçadas Obsoletas
STR_3190 :Caminhos Extras
STR_3191 :Grupo de Cenários
-STR_3192 :Entrada do Parque
+STR_3192 :Entradas dos Parques
STR_3193 :Água
STR_3195 :Lista de Invenções
STR_3196 :{WINDOW_COLOUR_2}Grupo de Pesquisa: {BLACK}{STRINGID}
@@ -2617,7 +2605,7 @@ STR_5368 :Redefinir status de acidente
STR_5371 :Seleção de Objetos
STR_5372 :Inverter seleção do botão direito do mouse
STR_5373 :Nome {STRINGID}
-STR_5374 :Data {STRINGID}
+STR_5374 :Data de modificação {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Este nome já existe
@@ -3785,3 +3773,23 @@ STR_6709 :Digite a intensidade da suavização entre {COMMA16} e {COMMA16}
STR_6710 :Ordenação estável
STR_6711 :Nome do arquivo:
STR_6712 :Salvar
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Nome do arquivo
+STR_6715 :Data de modificação
+STR_6716 :Tamanho do arquivo
+STR_6717 :Tamanho do arquivo {STRINGID}
+STR_6718 :Animações das Pessoinhas
+STR_6719 :Ao menos um objeto de animação de pessoinha de visitante deve ser selecionado
+STR_6720 :Ao menos um objeto de animação de pessoinha de faxineiro deve ser selecionado
+STR_6721 :Ao menos um objeto de animação de pessoinha de mecânico deve ser selecionado
+STR_6722 :Ao menos um objeto de animação de pessoinha de segurança deve ser selecionado
+STR_6723 :Ao menos um objeto de animação de pessoinha de animador deve ser selecionado
+STR_6724 :Textos dos Cenários
+STR_6725 :X:
+STR_6726 :Y:
+STR_6727 :Loop em mergulho (esquerda)
+STR_6728 :Loop em mergulho (direita)
+STR_6729 :Cabo de elevação deve estar imediatamente após a estação ou freio bloqueador
+STR_6730 :Exportar dados emscripten
+STR_6731 :Importar dados emscripten
+STR_6732 :Mostrar um botão na barra de ferramentas para girar a visualização no sentido anti-horário
diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt
index 780bd45f07..f481b9a414 100644
--- a/data/language/ru-RU.txt
+++ b/data/language/ru-RU.txt
@@ -1158,17 +1158,6 @@ STR_1773 :Допускается только одна фото секция
STR_1774 :Допускается только один кабельный лифт
STR_1777 :{WINDOW_COLOUR_2}Музыка
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Костюм панды
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Костюм тигра
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Костюм слона
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Римский костюм
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Костюм гориллы
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Костюм снеговика
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Костюм рыцаря
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Костюм космонавта
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Костюм бандита
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Костюм шерифа
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Костюм пирата
STR_1790 :Выберите цвет униформы для этого типа работников
STR_1791 :{WINDOW_COLOUR_2}Цвет формы:
STR_1792 :Отвечает на вызов по {STRINGID}
@@ -2173,7 +2162,6 @@ STR_3136 :Внимание: Этот дизайн будет построен
STR_3137 :Выберите Ближайший Пейзаж
STR_3138 :Сброс Выбора
STR_3139 :Кабельный лифт не может работать в этом режиме
-STR_3140 :Кабельный лифт должен начинаться сразу после станции
STR_3141 :Мульти-кольца невозможны с кабельным лифтом
STR_3142 :{WINDOW_COLOUR_2}Вместимость: {BLACK}{STRINGID}
STR_3143 :Показать людей на карте
@@ -2205,7 +2193,7 @@ STR_3188 :Знаки
STR_3189 :Дорожки
STR_3190 :Доп. пути
STR_3191 :Группы пейзажа
-STR_3192 :Вход в парк
+STR_3192 :Входы в парк
STR_3193 :Вода
STR_3195 :Изобретения
STR_3196 :{WINDOW_COLOUR_2} Разработка: {BLACK}{STRINGID}
@@ -2610,7 +2598,7 @@ STR_5368 :Сброс. ист. аварий
STR_5371 :Выбор объекта
STR_5372 :Инвертировать перетаскивание правой кнопкой мыши
STR_5373 :Имя {STRINGID}
-STR_5374 :Дата {STRINGID}
+STR_5374 :Дата изменения {STRINGID}
STR_5375 :▲
STR_5376 :▼
STR_5404 :Такое имя уже существует
@@ -3773,3 +3761,23 @@ STR_6709 :Введите силу сглаживания между {COMMA16}
STR_6710 :Стабильная сортировка
STR_6711 :Имя файла:
STR_6712 :Сохранить
+STR_6713 :{COMMA32} {STRINGID}
+STR_6714 :Имя файла
+STR_6715 :Дата изменения
+STR_6716 :Размер
+STR_6717 :Размер {STRINGID}
+STR_6718 :Анимации людей
+STR_6719 :Нужно выбрать хотя бы один объект анимации людей
+STR_6720 :Нужно выбрать хотя бы один объект анимации дворников
+STR_6721 :Нужно выбрать хотя бы один объект анимации механиков
+STR_6722 :Нужно выбрать хотя бы один объект анимации охранников
+STR_6723 :Нужно выбрать хотя бы один объект анимации развлекателей
+STR_6724 :Тексты сценариев
+STR_6725 :X:
+STR_6726 :Y:
+STR_6729 :Кабельный лифт должен начинаться сразу после станции или блок-тормоза
+STR_6727 :Петля со спуском (левая)
+STR_6728 :Петля со спуском (правая)
+STR_6732 :Показать кнопку вращения камеры против часовой стрелки
+STR_6730 :Экспорт данных emscripten
+STR_6731 :Импорт данных emscripten
diff --git a/data/language/sv-SE.txt b/data/language/sv-SE.txt
index cae9f1ba39..d7dab089a3 100644
--- a/data/language/sv-SE.txt
+++ b/data/language/sv-SE.txt
@@ -1161,17 +1161,6 @@ STR_1773 :Bara en fotosektion tillåten per åktur
STR_1774 :Bara en uppskjutskulle tillåten per åktur
STR_1777 :Musik för åkturer
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Pandadräkt
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tigerdräkt
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elefantdräkt
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Romersk dräkt
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilladräkt
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snögubbedräkt
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Riddardräkt
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronautdräkt
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Banditdräkt
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriffdräkt
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Piratdräkt
STR_1790 :Välj uniformfärg för den här sortens personal
STR_1791 :{WINDOW_COLOUR_2}Uniformfärg:
STR_1792 :Svarar på radioanrop om {STRINGID}
diff --git a/data/language/tr-TR.txt b/data/language/tr-TR.txt
index 130adc7edc..c4379c64e0 100644
--- a/data/language/tr-TR.txt
+++ b/data/language/tr-TR.txt
@@ -1151,17 +1151,6 @@ STR_1773 :Alet başı bir tane fotoğraf alanı inşa edilebilir
STR_1774 :Alet başı bir tane asansörlü tırmanma zinciri inşa edilebilir
STR_1777 :{WINDOW_COLOUR_2}Alet müziği
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda kıyafeti
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Kaplan kıyafeti
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Fil kıyafeti
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Romalı kıyafeti
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Goril kıyafeti
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Kardan adam kıyafeti
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Şövalye kıyafeti
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronot kıyafeti
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Eşkıya kıyafeti
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Şerif kıyafeti
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Korsan kıyafeti
STR_1790 :Bu işçinin üniforma{NEWLINE}rengini seçiniz
STR_1791 :{WINDOW_COLOUR_2}Üniforma rengi:
STR_1792 :{STRINGID} aletinin tamirine gidiyor
diff --git a/data/language/uk-UA.txt b/data/language/uk-UA.txt
index f312567fa7..aeccc88a49 100644
--- a/data/language/uk-UA.txt
+++ b/data/language/uk-UA.txt
@@ -1158,17 +1158,6 @@ STR_1773 :Only one on-ride photo section allowed per ride
STR_1774 :Only one cable lift hill allowed per ride
STR_1777 :Музика в атракціонах
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Костюм панди
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Костюм тигра
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Костюм слона
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Римський костюм
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Костюм горили
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Костюм сніговика
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Костюм лицаря
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Костюм астронавта
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Костюм бандита
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Костюм шерифа
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Костюм пірата
STR_1790 :Вибрати колір уніформи для цього типу працівників
STR_1791 :{WINDOW_COLOUR_2}Колір уніформи:
STR_1792 :Відповідає на {STRINGING} виклик про поломку
diff --git a/data/language/vi-VN.txt b/data/language/vi-VN.txt
index 7428862479..45ff9916b0 100644
--- a/data/language/vi-VN.txt
+++ b/data/language/vi-VN.txt
@@ -1154,17 +1154,6 @@ STR_1773 :Only one on-ride photo section allowed per ride
STR_1774 :Only one cable lift hill allowed per ride
STR_1777 :Ride music
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda costume
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiger costume
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elephant costume
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Roman costume
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla costume
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snowman costume
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Knight costume
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaut costume
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandit costume
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriff costume
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirate costume
STR_1790 :Select uniform colour for this type of staff
STR_1791 :{WINDOW_COLOUR_2}Uniform colour:
STR_1792 :Đang trả lời cuộc gọi vì {STRINGID} bị hỏng
diff --git a/data/language/zh-CN.txt b/data/language/zh-CN.txt
index c41afadb8b..a1d3e1fb13 100644
--- a/data/language/zh-CN.txt
+++ b/data/language/zh-CN.txt
@@ -1160,17 +1160,6 @@ STR_1773 :每个游乐设施只能建造一个照相区域
STR_1774 :每个游乐设施只能建造一个牵引轨道
STR_1777 :设施音乐
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00}熊猫服装
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00}老虎服装
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00}大象服装
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00}罗马服装
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00}大猩猩服装
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00}雪人服装
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00}骑士服装
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00}宇航员服装
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00}土匪服装
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00}警长服装
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00}海盗服装
STR_1790 :选择这种员工的制服颜色
STR_1791 :{WINDOW_COLOUR_2}制服的颜色:
STR_1792 :正在回应{STRINGID}的故障呼叫
diff --git a/data/language/zh-TW.txt b/data/language/zh-TW.txt
index 45f3bc32e3..bb63431abd 100644
--- a/data/language/zh-TW.txt
+++ b/data/language/zh-TW.txt
@@ -1160,17 +1160,6 @@ STR_1773 :每個遊樂設施只可建造一個即時照相區域
STR_1774 :每個遊樂設施只可建造一個纜索坡道
STR_1777 :音樂
STR_1778 :{STRINGID} - -
-STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} 熊貓服裝
-STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} 老虎服裝
-STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} 大象服裝
-STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} 羅馬服裝
-STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} 哥斯拉服裝
-STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} 雪人服裝
-STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} 騎士服裝
-STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} 太空人服裝
-STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} 土匪服裝
-STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} 警長服裝
-STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} 海盜服裝
STR_1790 :選擇這種員工的制服顏色
STR_1791 :{WINDOW_COLOUR_2}制服的顏色:
STR_1792 :回應{STRINGID}的故障呼叫中
diff --git a/distribution/changelog.txt b/distribution/changelog.txt
index 79970b84bb..f1dcb495dc 100644
--- a/distribution/changelog.txt
+++ b/distribution/changelog.txt
@@ -1,3 +1,24 @@
+0.4.19 (in development)
+------------------------------------------------------------------------
+- Feature: [#23328] Introducing peep animation objects, enabling custom entertainer costumes.
+- Feature: [#23569] Add large diagonal flat to steep and dive loop track pieces.
+- Improved: [#20683] Allow Giga Coaster cable lift to start after block brake section.
+- Improved: [#23328] The costume list in the staff window is now ordered alphabetically.
+- Improved: [#23540] The file browser now optionally shows a file size column.
+- Improved: [#23640] Building sprite repository with command line can use images array of JSON parkobj.
+- Improved: [#23660] The ‘special elements’ dropdown has been reorganised, now using multiple columns and separators.
+- Improved: [#23730] Added optional button to toolbar to rotate view anti-clockwise.
+- Change: [#23328] All RCT2 entertainer costumes are now available in legacy parks.
+- Fix: [#1479] Incorrect values provided by the in game console “get location” command.
+- Fix: [#21794] Lay-down coaster cars reverse on first frames of downwards corkscrew.
+- Fix: [#23221] Track designs are saved with an incorrect ‘air’ time statistic.
+- Fix: [#23368] Incorrect refund amount when deleting track pieces at or above 96m.
+- Fix: [#23508] Simultaneous virtual floors shown for ride and footpath.
+- Fix: [#23512] Holding brakes are skipped if they’re too close together.
+- Fix: [#23581] [Plugin] Food/drink items given to guests have no consumption duration set.
+- Fix: [#23591] “Install new track” button in Track Designs Manager is misaligned.
+- Fix: [#23618] Can no longer build diagonal brakes & block brakes on Steeplechase, Inverted Lay-down, & Inverted Multi-Dim roller coasters.
+
0.4.18 (2025-01-08)
------------------------------------------------------------------------
- Improved: [#23200] Add banked sloped turns and many other pieces to the Stand-Up and Classic Stand-Up Roller Coaster.
diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts
index 24b36a1244..a9bf7f0c80 100644
--- a/distribution/openrct2.d.ts
+++ b/distribution/openrct2.d.ts
@@ -4874,6 +4874,9 @@ declare global {
frameBase: number;
frameCount?: number;
frameDuration?: number;
+ primaryColour?: number;
+ secondaryColour?: number;
+ tertiaryColour?: number;
offset?: ScreenCoordsXY;
}
diff --git a/distribution/windows/readme.md b/distribution/windows/readme.md
index 573a74915b..d684897d39 100644
--- a/distribution/windows/readme.md
+++ b/distribution/windows/readme.md
@@ -1,6 +1,4 @@
# Windows Installer
This directory contains the script and resources for the Windows installer. The installer is created using [Nullsoft Scriptable Install System (NSIS)](http://nsis.sourceforge.net) version v3.0a0+.
-As there is currently only a 32 bit version of OpenRCT2 available, the architecture and windows version checks have been disabled. These will be re-enabled once OpenRCT2 is a stand alone executable.
-
Code based on [OpenTTD](http://openttd.org) installer.
diff --git a/emscripten/deps.js b/emscripten/deps.js
new file mode 100644
index 0000000000..2967b9e6a5
--- /dev/null
+++ b/emscripten/deps.js
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2014-2025 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.
+ *****************************************************************************/
+var EmscriptenDeps = {
+ ExportPersistentData: () =>
+ {
+ if (!window.JSZip)
+ {
+ alert("JSZip library not found. Aborting");
+ return;
+ }
+ const zipFolder = (folder) =>
+ {
+ let zip = new JSZip();
+ const processFolder = (name) => {
+ let contents;
+ try {
+ contents = Module.FS.readdir(name);
+ } catch(e) {
+ return;
+ }
+ contents.forEach((entry) => {
+ if ([".", ".."].includes(entry)) return;
+ try {
+ Module.FS.readFile(name + entry);
+ processFile(name + entry);
+ } catch(e) {
+ processFolder(name + entry + "/");
+ }
+ })
+ }
+ const processFile = (name) => {
+ zip.file(name, Module.FS.readFile(name));
+ }
+ processFolder(folder);
+ return zip;
+ }
+ const zip = zipFolder("/persistent/");
+ zip.generateAsync({type: "blob"}).then(blob => {
+ const a = document.createElement("a");
+
+ a.href = URL.createObjectURL(blob);
+ a.download = "OpenRCT2-emscripten.zip";
+ a.click();
+ setTimeout(() => URL.revokeObjectURL(a.href), 1000);
+ })
+ },
+ ImportPersistentData: () =>
+ {
+ if (!window.JSZip)
+ {
+ alert("JSZip library not found. Aborting");
+ return;
+ }
+ const clearDatabase = async(dir) => {
+ await new Promise(res => Module.FS.syncfs(false, res));
+ const processFolder = (path) => {
+ let contents;
+ try {
+ contents = Module.FS.readdir(path);
+ } catch(e) {
+ return;
+ }
+ contents.forEach((entry) => {
+ if ([".", ".."].includes(entry)) return;
+ try {
+ Module.FS.readFile(path + entry);
+ Module.FS.unlink(path + entry);
+ } catch(e) {
+ processFolder(path + entry + "/");
+ }
+ })
+ if (path === dir) return;
+ try {
+ Module.FS.rmdir(path, {recursive: true});
+ } catch(e) {
+ console.log("Could not remove:", path);
+ }
+ }
+ processFolder(dir);
+ await new Promise(res => Module.FS.syncfs(false, res));
+ };
+ if (!confirm("Are you sure? This will wipe all current data.")) return;
+ alert("Select a zip file");
+ const input = document.createElement("input");
+ input.type = "file";
+ input.addEventListener("change", async (e) => {
+ let zip = new JSZip();
+ try {
+ zip = await zip.loadAsync(e.target.files[0]);
+ } catch(e) {
+ alert("Not a zip file!");
+ return;
+ }
+ await clearDatabase("/persistent/");
+ for (const k in zip.files) {
+ const entry = zip.files[k];
+ if (entry.dir) {
+ try {
+ Module.FS.mkdir("/"+k);
+ } catch(e) {}
+ } else {
+ Module.FS.writeFile("/"+k, await entry.async("uint8array"));
+ }
+ }
+ console.log("Database restored");
+ })
+ input.click();
+ }
+};
+
+mergeInto(LibraryManager.library, EmscriptenDeps);
diff --git a/emscripten/static/index.html b/emscripten/static/index.html
new file mode 100644
index 0000000000..546766358c
--- /dev/null
+++ b/emscripten/static/index.html
@@ -0,0 +1,30 @@
+
+
+
+ OpenRCT2
+
+
+
+
+
+
+ Please wait... Loading webassembly
+
+
Please select your RCT2 assets (zip file):
+
+
+
+
+
+
diff --git a/emscripten/static/index.js b/emscripten/static/index.js
new file mode 100644
index 0000000000..7eab066565
--- /dev/null
+++ b/emscripten/static/index.js
@@ -0,0 +1,231 @@
+/*****************************************************************************
+ * Copyright (c) 2014-2025 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.
+ *****************************************************************************/
+(async () =>
+{
+ await new Promise(res => window.addEventListener("DOMContentLoaded", res));
+ if (!window.SharedArrayBuffer)
+ {
+ document.getElementById("loadingWebassembly").innerText = "Error! SharedArrayBuffer is not defined. This page required the CORP and COEP response headers.";
+ }
+ if (!window.WebAssembly)
+ {
+ document.getElementById("loadingWebassembly").innerText = "Error! This page requires WebAssembly. Please upgrade your browser or enable WebAssembly support.";
+ }
+
+ window.Module = await window.OPENRCT2_WEB(
+ {
+ noInitialRun: true,
+ arguments: [],
+ preRun: [],
+ postRun: [],
+ canvas: document.getElementById("canvas"),
+ print: function(msg)
+ {
+ console.log(msg);
+ },
+ printErr: function(msg)
+ {
+ console.log(msg);
+ },
+ totalDependencies: 0,
+ monitorRunDependencies: () => {},
+ locateFile: function(fileName)
+ {
+ console.log("loading", fileName);
+ return fileName;
+ }
+ });
+
+ Module.FS.mkdir("/persistent");
+ Module.FS.mount(Module.FS.filesystems.IDBFS, {autoPersist: true}, '/persistent');
+
+ Module.FS.mkdir("/RCT");
+ Module.FS.mount(Module.FS.filesystems.IDBFS, {autoPersist: true}, '/RCT');
+
+ Module.FS.mkdir("/OpenRCT2");
+ Module.FS.mount(Module.FS.filesystems.IDBFS, {autoPersist: true}, '/OpenRCT2');
+
+ await new Promise(res => Module.FS.syncfs(true, res));
+
+ let configExists = fileExists("/persistent/config.ini");
+ if (!configExists)
+ {
+ Module.FS.writeFile("/persistent/config.ini", `
+[general]
+game_path = "/RCT"
+uncap_fps = true
+window_scale = 1.750000
+`);
+ }
+
+ const assetsOK = await updateAssets();
+ if (!assetsOK)
+ {
+ return
+ }
+
+ Module.FS.writeFile("/OpenRCT2/changelog.txt", `EMSCRIPTEN --- README
+
+Since we're running in the web browser, we don't have direct access to the file system.
+All save data is saved under the directory /persistent.
+
+ALWAYS be sure to save to /persistent/saves when saving a game! Otherwise it will be wiped!
+
+You can import/export the /persistent folder in the options menu.`);
+ document.getElementById("loadingWebassembly").remove();
+
+ let filesFound = fileExists("/RCT/Data/ch.dat");
+
+ if (!filesFound)
+ {
+ document.getElementById("beforeLoad").style.display = "";
+ await new Promise(res =>
+ {
+ document.getElementById("selectFile").addEventListener("change", async (e) =>
+ {
+ if (await extractZip(e.target.files[0], (zip) =>
+ {
+ if (zip !== null)
+ {
+ if (zip.file("Data/ch.dat"))
+ {
+ document.getElementById("beforeLoad").remove();
+ return "/RCT/";
+ }
+ else if (zip.file("RCT/Data/ch.dat"))
+ {
+ document.getElementById("beforeLoad").remove();
+ return "/";
+ }
+ }
+ document.getElementById("statusMsg").innerText = "That doesn't look right. Your file should be a zip file containing Data/ch.dat. Please select your OpenRCT2 contents (zip file):";
+ return false;
+ }))
+ {
+ res();
+ }
+ });
+ });
+ }
+ Module.canvas.style.display = "";
+ Module.callMain(["--user-data-path=/persistent/", "--openrct2-data-path=/OpenRCT2/"]);
+})();
+
+async function updateAssets() {
+ let currentVersion = "";
+ try {
+ currentVersion = Module.FS.readFile("/OpenRCT2/version", {encoding: "utf8"});
+ console.log("Found asset version", currentVersion);
+ } catch(e) {
+ console.log("No asset version found");
+ };
+ let assetsVersion = "DEBUG";
+ try {
+ assetsVersion = Module.ccall("GetVersion", "string");
+ } catch(e) {
+ console.warn("Could not call 'GetVersion'! Is it added to EXPORTED_FUNCTIONS? Is ccall added to EXPORTED_RUNTIME_METHODS?");
+ };
+
+ //Always pull assets on a debug build
+ if (currentVersion !== assetsVersion || assetsVersion.includes("DEBUG"))
+ {
+ console.log("Updating assets to", assetsVersion);
+ document.getElementById("loadingWebassembly").innerText = "Asset update found. Downloading...";
+ await clearDatabase("/OpenRCT2/");
+
+ // Fetch the assets.zip file
+ const response = await fetch("assets.zip");
+ if (!response.ok) {
+ if (response.status === 404) {
+ document.getElementById("loadingWebassembly").innerText = "Error! Assets file not found (404).";
+ } else {
+ document.getElementById("loadingWebassembly").innerText = `Error! Failed to download assets (status: ${response.status}).`;
+ }
+ return false;
+ } else {
+ document.getElementById("loadingWebassembly").innerText = "Downloaded assets.zip";
+ }
+
+ await extractZip(await response.blob(), () => {
+ return "/OpenRCT2/";
+ });
+ Module.FS.writeFile("/OpenRCT2/version", assetsVersion.toString());
+ }
+ return true;
+}
+
+async function extractZip(data, checkZip) {
+ let zip = new JSZip();
+ let contents;
+ try {
+ contents = await zip.loadAsync(data);
+ } catch(e) {
+ if (typeof checkZip === "function")
+ {
+ checkZip(null);
+ }
+ throw e;
+ }
+ let base = "/";
+ if (typeof checkZip === "function")
+ {
+ const cont = checkZip(contents);
+ if (cont === false) return false;
+ base = cont;
+ }
+ for (const k in contents.files) {
+ const entry = contents.files[k];
+ if (entry.dir)
+ {
+ try {
+ Module.FS.mkdir(base+k);
+ } catch(e) {}
+ }
+ else
+ {
+ Module.FS.writeFile(base+k, await entry.async("uint8array"));
+ }
+ }
+ return true;
+}
+async function clearDatabase(dir) {
+ await new Promise(res => Module.FS.syncfs(false, res));
+ const processFolder = (path) => {
+ let contents;
+ try {
+ contents = Module.FS.readdir(path);
+ } catch(e) {
+ return;
+ }
+ contents.forEach((entry) => {
+ if ([".", ".."].includes(entry)) return;
+ try {
+ Module.FS.readFile(path + entry);
+ Module.FS.unlink(path + entry);
+ } catch(e) {
+ processFolder(path + entry + "/");
+ }
+ })
+ if (path === dir) return;
+ try {
+ Module.FS.rmdir(path, {recursive: true});
+ } catch(e) {
+ console.log("Could not remove:", path);
+ }
+ }
+ processFolder(dir);
+ await new Promise(res => Module.FS.syncfs(false, res));
+}
+function fileExists(path) {
+ try {
+ Module.FS.readFile(path);
+ return true;
+ } catch(e) {};
+ return false;
+}
diff --git a/openrct2.proj b/openrct2.proj
index c47a61e775..179c9a9f12 100644
--- a/openrct2.proj
+++ b/openrct2.proj
@@ -45,14 +45,14 @@
9984c1e317dcfb3aaf8e17f1db2ebb0f771e2373
https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.14/title-sequences.zip
6c04781b959b468e1f65ec2d2f21f5aaa5e5724d
- https://github.com/OpenRCT2/objects/releases/download/v1.4.12/objects.zip
- d9b745f3b9dacf5c204a43375e4d93dfe3548938
+ https://github.com/OpenRCT2/objects/releases/download/v1.5.1/objects.zip
+ e922b9fd779e7752176f1d0d8766c2ee6ad1e41b
https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip
b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb
https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip
ba170fa6d777b309c15420f4b6eb3fa25082a9d1
- https://github.com/OpenRCT2/replays/releases/download/v0.0.84/replays.zip
- 90B848AB344E29A2CF1E3E48539F06F5845772C3
+ https://github.com/OpenRCT2/replays/releases/download/v0.0.86/replays.zip
+ 637E73F20C03DCD52ACA36FAEE15DADB31797FE0
diff --git a/readme.md b/readme.md
index c592acc44f..dba893e4e3 100644
--- a/readme.md
+++ b/readme.md
@@ -226,7 +226,7 @@ OpenRCT2 requires original files of RollerCoaster Tycoon 2 to play. It can be bo
---
# 4. Contributing
-OpenRCT2 uses the [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#gitflow-workflow). If you are implementing a new feature or logic from the original game, please branch off and perform pull requests to ```develop```. If you are fixing a bug for the next release, please branch off and perform pull requests to the correct release branch. ```master``` only contains tagged releases, you should never branch off this.
+OpenRCT2 uses the [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#gitflow-workflow). If you are implementing a new feature or fixing a bug, please branch off and perform pull requests to ```develop```. ```master``` only contains tagged releases, you should never branch off this.
Please read our [contributing guidelines](https://github.com/OpenRCT2/OpenRCT2/blob/develop/CONTRIBUTING.md) for information.
diff --git a/resources/g2/icons/peep_animations.png b/resources/g2/icons/peep_animations.png
new file mode 100644
index 0000000000..f1c334ba8d
Binary files /dev/null and b/resources/g2/icons/peep_animations.png differ
diff --git a/resources/g2/icons/rotate_view_anti-clockwise.png b/resources/g2/icons/rotate_view_anti-clockwise.png
new file mode 100644
index 0000000000..ce13b23d85
Binary files /dev/null and b/resources/g2/icons/rotate_view_anti-clockwise.png differ
diff --git a/resources/g2/sprites.json b/resources/g2/sprites.json
index fe4e95939f..201f0062aa 100644
--- a/resources/g2/sprites.json
+++ b/resources/g2/sprites.json
@@ -327,6 +327,11 @@
{
"path": "icons/folder.png"
},
+ {
+ "path": "icons/peep_animations.png",
+ "x": 2,
+ "y": 1
+ },
{
"path": "loader/loader_hybrid_supports.png",
"y": 10
@@ -6592,6 +6597,342 @@
"y": -22,
"palette": "keep"
},
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_1_1.png",
+ "x": -32,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_1_2.png",
+ "x": -32,
+ "y": -25,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_1_3.png",
+ "x": -32,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_2_1.png",
+ "x": -8,
+ "y": -10,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_2_3.png",
+ "x": -8,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_3_1.png",
+ "x": -32,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_3_2.png",
+ "x": -32,
+ "y": -25,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_3_3.png",
+ "x": -32,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_4_1.png",
+ "x": -8,
+ "y": -16,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_4_2.png",
+ "x": -8,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/flat_to_steep_up_diag_4_3.png",
+ "x": -8,
+ "y": -89,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_1_1.png",
+ "x": -32,
+ "y": -47,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_1_2.png",
+ "x": -32,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_1_3.png",
+ "x": -32,
+ "y": -5,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_2_1.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_2_3.png",
+ "x": -8,
+ "y": -14,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_3_1.png",
+ "x": -32,
+ "y": -47,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_3_2.png",
+ "x": -32,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_3_3.png",
+ "x": -32,
+ "y": -5,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_4_1.png",
+ "x": -8,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_4_2.png",
+ "x": -8,
+ "y": -72,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/steep_to_flat_up_diag_4_3.png",
+ "x": -8,
+ "y": -42,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_1_1.png",
+ "x": -32,
+ "y": -31,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_1_2.png",
+ "x": -32,
+ "y": -41,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_1_3.png",
+ "x": -31,
+ "y": -41,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_1_4.png",
+ "x": -18,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_2_1.png",
+ "x": -8,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_2_2.png",
+ "x": -7,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_2_3.png",
+ "x": -25,
+ "y": -25,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_2_4.png",
+ "x": -28,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_3_1.png",
+ "x": 0,
+ "y": -33,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_3_2.png",
+ "x": -14,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_3_3.png",
+ "x": -24,
+ "y": -21,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_3_4.png",
+ "x": -22,
+ "y": -14,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_4_1.png",
+ "x": -11,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_4_2.png",
+ "x": -45,
+ "y": -83,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_4_3.png",
+ "x": -24,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_left_4_4.png",
+ "x": -22,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_1_1.png",
+ "x": -32,
+ "y": -33,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_1_2.png",
+ "x": -32,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_1_3.png",
+ "x": -28,
+ "y": -21,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_1_4.png",
+ "x": -32,
+ "y": -14,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_2_1.png",
+ "x": -9,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_2_2.png",
+ "x": -20,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_2_3.png",
+ "x": -11,
+ "y": -25,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_2_4.png",
+ "x": -22,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_3_1.png",
+ "x": 0,
+ "y": -31,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_3_2.png",
+ "x": -12,
+ "y": -41,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_3_3.png",
+ "x": -24,
+ "y": -41,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_3_4.png",
+ "x": -22,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_4_1.png",
+ "x": -8,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_4_2.png",
+ "x": -4,
+ "y": -83,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_4_3.png",
+ "x": -30,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/lattice_triangle/dive_loop_45_right_4_4.png",
+ "x": -23,
+ "y": -23,
+ "palette": "keep"
+ },
{
"path": "track/mini/booster_1.png",
"x": -22,
@@ -8736,6 +9077,342 @@
"y": -29,
"palette": "keep"
},
+ {
+ "path": "track/bm/flat_to_steep_up_diag_1_1.png",
+ "x": -32,
+ "y": -7,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_1_2.png",
+ "x": -32,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_1_3.png",
+ "x": -32,
+ "y": -46,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_2_1.png",
+ "x": -13,
+ "y": -9,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_2_3.png",
+ "x": -13,
+ "y": -24,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_3_1.png",
+ "x": -32,
+ "y": -7,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_3_2.png",
+ "x": -32,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_3_3.png",
+ "x": -32,
+ "y": -45,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_4_1.png",
+ "x": -13,
+ "y": -16,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_4_2.png",
+ "x": -13,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/flat_to_steep_up_diag_4_3.png",
+ "x": -13,
+ "y": -88,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_1_1.png",
+ "x": -32,
+ "y": -49,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_1_2.png",
+ "x": -32,
+ "y": -21,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_1_3.png",
+ "x": -32,
+ "y": -7,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_2_1.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_2_3.png",
+ "x": -13,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_3_1.png",
+ "x": -32,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_3_2.png",
+ "x": -32,
+ "y": -21,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_3_3.png",
+ "x": -32,
+ "y": -7,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_4_1.png",
+ "x": -13,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_4_2.png",
+ "x": -13,
+ "y": -72,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/steep_to_flat_up_diag_4_3.png",
+ "x": -13,
+ "y": -41,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_1_1.png",
+ "x": -32,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_1_2.png",
+ "x": -32,
+ "y": -47,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_1_3.png",
+ "x": -32,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_1_4.png",
+ "x": -20,
+ "y": -22,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_2_1.png",
+ "x": -13,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_2_2.png",
+ "x": -12,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_2_3.png",
+ "x": -26,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_2_4.png",
+ "x": -27,
+ "y": -12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_3_1.png",
+ "x": 0,
+ "y": -36,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_3_2.png",
+ "x": -19,
+ "y": -29,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_3_3.png",
+ "x": -37,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_3_4.png",
+ "x": -26,
+ "y": -12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_4_1.png",
+ "x": -16,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_4_2.png",
+ "x": -60,
+ "y": -96,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_4_3.png",
+ "x": -28,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_left_4_4.png",
+ "x": -25,
+ "y": -22,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_1_1.png",
+ "x": -32,
+ "y": -37,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_1_2.png",
+ "x": -32,
+ "y": -30,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_1_3.png",
+ "x": -30,
+ "y": -21,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_1_4.png",
+ "x": -32,
+ "y": -12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_2_1.png",
+ "x": -15,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_2_2.png",
+ "x": -25,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_2_3.png",
+ "x": -13,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_2_4.png",
+ "x": -26,
+ "y": -12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_3_1.png",
+ "x": 0,
+ "y": -31,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_3_2.png",
+ "x": -14,
+ "y": -45,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_3_3.png",
+ "x": -28,
+ "y": -43,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_3_4.png",
+ "x": -25,
+ "y": -22,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_4_1.png",
+ "x": -13,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_4_2.png",
+ "x": -9,
+ "y": -89,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_4_3.png",
+ "x": -31,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/bm/dive_loop_45_right_4_4.png",
+ "x": -24,
+ "y": -22,
+ "palette": "keep"
+ },
{
"path": "track/railway/quarter_turn_3_tiles_sw_se_part_3.png",
"x": -8,
@@ -19207,6 +19884,342 @@
"y": -25,
"palette": "keep"
},
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_1_1.png",
+ "x": -32,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_1_2.png",
+ "x": -32,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_1_3.png",
+ "x": -32,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_2_1.png",
+ "x": -14,
+ "y": -8,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_2_3.png",
+ "x": -14,
+ "y": -25,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_3_1.png",
+ "x": -32,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_3_2.png",
+ "x": -32,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_3_3.png",
+ "x": -32,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_4_1.png",
+ "x": -14,
+ "y": -16,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_4_2.png",
+ "x": -14,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/flat_to_steep_up_diag_4_3.png",
+ "x": -14,
+ "y": -88,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_1_1.png",
+ "x": -32,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_1_2.png",
+ "x": -32,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_1_3.png",
+ "x": -32,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_2_1.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_2_3.png",
+ "x": -14,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_3_1.png",
+ "x": -32,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_3_2.png",
+ "x": -32,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_3_3.png",
+ "x": -32,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_4_1.png",
+ "x": -14,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_4_2.png",
+ "x": -14,
+ "y": -72,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/steep_to_flat_up_diag_4_3.png",
+ "x": -14,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_1_1.png",
+ "x": -32,
+ "y": -30,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_1_2.png",
+ "x": -32,
+ "y": -46,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_1_3.png",
+ "x": -32,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_1_4.png",
+ "x": -21,
+ "y": -17,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_2_1.png",
+ "x": -14,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_2_2.png",
+ "x": -13,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_2_3.png",
+ "x": -27,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_2_4.png",
+ "x": -26,
+ "y": -10,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_3_1.png",
+ "x": 0,
+ "y": -35,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_3_2.png",
+ "x": -19,
+ "y": -31,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_3_3.png",
+ "x": -40,
+ "y": -15,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_3_4.png",
+ "x": -24,
+ "y": -8,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_4_1.png",
+ "x": -17,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_4_2.png",
+ "x": -55,
+ "y": -90,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_4_3.png",
+ "x": -28,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_left_4_4.png",
+ "x": -24,
+ "y": -17,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_1_1.png",
+ "x": -32,
+ "y": -35,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_1_2.png",
+ "x": -32,
+ "y": -31,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_1_3.png",
+ "x": -31,
+ "y": -15,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_1_4.png",
+ "x": -32,
+ "y": -8,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_2_1.png",
+ "x": -15,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_2_2.png",
+ "x": -24,
+ "y": -27,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_2_3.png",
+ "x": -13,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_2_4.png",
+ "x": -24,
+ "y": -10,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_3_1.png",
+ "x": 0,
+ "y": -30,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_3_2.png",
+ "x": -14,
+ "y": -46,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_3_3.png",
+ "x": -28,
+ "y": -44,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_3_4.png",
+ "x": -24,
+ "y": -17,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_4_1.png",
+ "x": -14,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_4_2.png",
+ "x": -10,
+ "y": -82,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_4_3.png",
+ "x": -27,
+ "y": -40,
+ "palette": "keep"
+ },
+ {
+ "path": "track/corkscrew/dive_loop_45_right_4_4.png",
+ "x": -21,
+ "y": -17,
+ "palette": "keep"
+ },
{
"path": "track/lim/barrel_roll_left_1_1.png",
"x": -22,
@@ -35474,6 +36487,342 @@
"y": -15,
"palette": "keep"
},
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_1_1.png",
+ "x": -32,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_1_2.png",
+ "x": -32,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_1_3.png",
+ "x": -32,
+ "y": -39,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_2_1.png",
+ "x": -3,
+ "y": -6,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_2_3.png",
+ "x": -3,
+ "y": -22,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_3_1.png",
+ "x": -32,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_3_2.png",
+ "x": -32,
+ "y": -20,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_3_3.png",
+ "x": -32,
+ "y": -39,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_4_1.png",
+ "x": -3,
+ "y": -16,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_4_2.png",
+ "x": -3,
+ "y": -48,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/flat_to_steep_up_diag_4_3.png",
+ "x": -3,
+ "y": -85,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_1_1.png",
+ "x": -32,
+ "y": -42,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_1_2.png",
+ "x": -32,
+ "y": -14,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_1_3.png",
+ "x": -32,
+ "y": 1,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_2_1.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_2_2.png",
+ "x": 0,
+ "y": 0,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_2_3.png",
+ "x": -3,
+ "y": -10,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_3_1.png",
+ "x": -32,
+ "y": -42,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_3_2.png",
+ "x": -32,
+ "y": -14,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_3_3.png",
+ "x": -32,
+ "y": 1,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_4_1.png",
+ "x": -3,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_4_2.png",
+ "x": -3,
+ "y": -72,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/steep_to_flat_up_diag_4_3.png",
+ "x": -3,
+ "y": -37,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_1_1.png",
+ "x": -32,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_1_2.png",
+ "x": -32,
+ "y": -37,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_1_3.png",
+ "x": -27,
+ "y": -38,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_1_4.png",
+ "x": -14,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_2_1.png",
+ "x": -3,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_2_2.png",
+ "x": -1,
+ "y": -24,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_2_3.png",
+ "x": -20,
+ "y": -16,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_2_4.png",
+ "x": -23,
+ "y": -4,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_3_1.png",
+ "x": 0,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_3_2.png",
+ "x": -12,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_3_3.png",
+ "x": -16,
+ "y": -12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_3_4.png",
+ "x": -18,
+ "y": -3,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_4_1.png",
+ "x": -7,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_4_2.png",
+ "x": -24,
+ "y": -46,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_4_3.png",
+ "x": -24,
+ "y": -38,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_left_4_4.png",
+ "x": -18,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_1_1.png",
+ "x": -32,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_1_2.png",
+ "x": -32,
+ "y": -23,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_1_3.png",
+ "x": -24,
+ "y": -12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_1_4.png",
+ "x": -32,
+ "y": -3,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_2_1.png",
+ "x": -5,
+ "y": 12,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_2_2.png",
+ "x": -19,
+ "y": -24,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_2_3.png",
+ "x": -11,
+ "y": -16,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_2_4.png",
+ "x": -18,
+ "y": -4,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_3_1.png",
+ "x": 0,
+ "y": -26,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_3_2.png",
+ "x": -11,
+ "y": -37,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_3_3.png",
+ "x": -22,
+ "y": -38,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_3_4.png",
+ "x": -18,
+ "y": -13,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_4_1.png",
+ "x": -3,
+ "y": -32,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_4_2.png",
+ "x": -1,
+ "y": -80,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_4_3.png",
+ "x": -23,
+ "y": -38,
+ "palette": "keep"
+ },
+ {
+ "path": "track/raptor/dive_loop_45_right_4_4.png",
+ "x": -14,
+ "y": -13,
+ "palette": "keep"
+ },
{
"path": "track/raptor/flat_lift_1.png",
"x": -18,
@@ -38571,5 +39920,8 @@
"x": -32,
"y": 15,
"palette": "keep"
+ },
+ {
+ "path": "icons/rotate_view_anti-clockwise.png"
}
]
diff --git a/resources/g2/track/bm/dive_loop_45_left_1_1.png b/resources/g2/track/bm/dive_loop_45_left_1_1.png
new file mode 100644
index 0000000000..79f3cbe28c
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_1_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_1_2.png b/resources/g2/track/bm/dive_loop_45_left_1_2.png
new file mode 100644
index 0000000000..8859b18970
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_1_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_1_3.png b/resources/g2/track/bm/dive_loop_45_left_1_3.png
new file mode 100644
index 0000000000..9771a16644
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_1_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_1_4.png b/resources/g2/track/bm/dive_loop_45_left_1_4.png
new file mode 100644
index 0000000000..7e3a09d563
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_1_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_2_1.png b/resources/g2/track/bm/dive_loop_45_left_2_1.png
new file mode 100644
index 0000000000..54df52b812
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_2_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_2_2.png b/resources/g2/track/bm/dive_loop_45_left_2_2.png
new file mode 100644
index 0000000000..2cb8cafd64
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_2_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_2_3.png b/resources/g2/track/bm/dive_loop_45_left_2_3.png
new file mode 100644
index 0000000000..d3bf497762
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_2_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_2_4.png b/resources/g2/track/bm/dive_loop_45_left_2_4.png
new file mode 100644
index 0000000000..361d40b67d
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_2_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_3_1.png b/resources/g2/track/bm/dive_loop_45_left_3_1.png
new file mode 100644
index 0000000000..b7cfb80ee4
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_3_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_3_2.png b/resources/g2/track/bm/dive_loop_45_left_3_2.png
new file mode 100644
index 0000000000..2bfc6b3957
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_3_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_3_3.png b/resources/g2/track/bm/dive_loop_45_left_3_3.png
new file mode 100644
index 0000000000..b45bd199f4
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_3_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_3_4.png b/resources/g2/track/bm/dive_loop_45_left_3_4.png
new file mode 100644
index 0000000000..67994bc37b
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_3_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_4_1.png b/resources/g2/track/bm/dive_loop_45_left_4_1.png
new file mode 100644
index 0000000000..756ce82f2b
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_4_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_4_2.png b/resources/g2/track/bm/dive_loop_45_left_4_2.png
new file mode 100644
index 0000000000..3628fce680
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_4_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_4_3.png b/resources/g2/track/bm/dive_loop_45_left_4_3.png
new file mode 100644
index 0000000000..df09479226
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_4_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_left_4_4.png b/resources/g2/track/bm/dive_loop_45_left_4_4.png
new file mode 100644
index 0000000000..578e26e77f
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_left_4_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_1_1.png b/resources/g2/track/bm/dive_loop_45_right_1_1.png
new file mode 100644
index 0000000000..bcf98c201a
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_1_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_1_2.png b/resources/g2/track/bm/dive_loop_45_right_1_2.png
new file mode 100644
index 0000000000..8403b18d43
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_1_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_1_3.png b/resources/g2/track/bm/dive_loop_45_right_1_3.png
new file mode 100644
index 0000000000..7679e76035
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_1_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_1_4.png b/resources/g2/track/bm/dive_loop_45_right_1_4.png
new file mode 100644
index 0000000000..633cfd3c55
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_1_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_2_1.png b/resources/g2/track/bm/dive_loop_45_right_2_1.png
new file mode 100644
index 0000000000..ac3cbf9c06
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_2_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_2_2.png b/resources/g2/track/bm/dive_loop_45_right_2_2.png
new file mode 100644
index 0000000000..a12088fe86
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_2_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_2_3.png b/resources/g2/track/bm/dive_loop_45_right_2_3.png
new file mode 100644
index 0000000000..a3b7c671d0
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_2_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_2_4.png b/resources/g2/track/bm/dive_loop_45_right_2_4.png
new file mode 100644
index 0000000000..18c42fd1a7
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_2_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_3_1.png b/resources/g2/track/bm/dive_loop_45_right_3_1.png
new file mode 100644
index 0000000000..053095da0e
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_3_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_3_2.png b/resources/g2/track/bm/dive_loop_45_right_3_2.png
new file mode 100644
index 0000000000..a2dbc61cf7
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_3_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_3_3.png b/resources/g2/track/bm/dive_loop_45_right_3_3.png
new file mode 100644
index 0000000000..d1d342be73
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_3_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_3_4.png b/resources/g2/track/bm/dive_loop_45_right_3_4.png
new file mode 100644
index 0000000000..122ab9dffa
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_3_4.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_4_1.png b/resources/g2/track/bm/dive_loop_45_right_4_1.png
new file mode 100644
index 0000000000..a7d9e9be5b
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_4_1.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_4_2.png b/resources/g2/track/bm/dive_loop_45_right_4_2.png
new file mode 100644
index 0000000000..ad3a0436ff
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_4_2.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_4_3.png b/resources/g2/track/bm/dive_loop_45_right_4_3.png
new file mode 100644
index 0000000000..c35ad2b7f4
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_4_3.png differ
diff --git a/resources/g2/track/bm/dive_loop_45_right_4_4.png b/resources/g2/track/bm/dive_loop_45_right_4_4.png
new file mode 100644
index 0000000000..786fbcdbc5
Binary files /dev/null and b/resources/g2/track/bm/dive_loop_45_right_4_4.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_1_1.png b/resources/g2/track/bm/flat_to_steep_up_diag_1_1.png
new file mode 100644
index 0000000000..07a4ac05ed
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_1_1.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_1_2.png b/resources/g2/track/bm/flat_to_steep_up_diag_1_2.png
new file mode 100644
index 0000000000..d7f3b0de9c
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_1_2.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_1_3.png b/resources/g2/track/bm/flat_to_steep_up_diag_1_3.png
new file mode 100644
index 0000000000..c0ad64d04b
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_1_3.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_2_1.png b/resources/g2/track/bm/flat_to_steep_up_diag_2_1.png
new file mode 100644
index 0000000000..43ad8945e6
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_2_1.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_2_2.png b/resources/g2/track/bm/flat_to_steep_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_2_2.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_2_3.png b/resources/g2/track/bm/flat_to_steep_up_diag_2_3.png
new file mode 100644
index 0000000000..0c089d227d
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_2_3.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_3_1.png b/resources/g2/track/bm/flat_to_steep_up_diag_3_1.png
new file mode 100644
index 0000000000..c4aa940153
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_3_1.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_3_2.png b/resources/g2/track/bm/flat_to_steep_up_diag_3_2.png
new file mode 100644
index 0000000000..b46e224440
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_3_2.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_3_3.png b/resources/g2/track/bm/flat_to_steep_up_diag_3_3.png
new file mode 100644
index 0000000000..425f7ea904
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_3_3.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_4_1.png b/resources/g2/track/bm/flat_to_steep_up_diag_4_1.png
new file mode 100644
index 0000000000..40f1070761
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_4_1.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_4_2.png b/resources/g2/track/bm/flat_to_steep_up_diag_4_2.png
new file mode 100644
index 0000000000..7b9b96bf82
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_4_2.png differ
diff --git a/resources/g2/track/bm/flat_to_steep_up_diag_4_3.png b/resources/g2/track/bm/flat_to_steep_up_diag_4_3.png
new file mode 100644
index 0000000000..afbe70371c
Binary files /dev/null and b/resources/g2/track/bm/flat_to_steep_up_diag_4_3.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_1_1.png b/resources/g2/track/bm/steep_to_flat_up_diag_1_1.png
new file mode 100644
index 0000000000..59f9c84cc9
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_1_1.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_1_2.png b/resources/g2/track/bm/steep_to_flat_up_diag_1_2.png
new file mode 100644
index 0000000000..de21ddfb91
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_1_2.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_1_3.png b/resources/g2/track/bm/steep_to_flat_up_diag_1_3.png
new file mode 100644
index 0000000000..093080da19
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_1_3.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_2_1.png b/resources/g2/track/bm/steep_to_flat_up_diag_2_1.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_2_1.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_2_2.png b/resources/g2/track/bm/steep_to_flat_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_2_2.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_2_3.png b/resources/g2/track/bm/steep_to_flat_up_diag_2_3.png
new file mode 100644
index 0000000000..3cf5dfbf46
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_2_3.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_3_1.png b/resources/g2/track/bm/steep_to_flat_up_diag_3_1.png
new file mode 100644
index 0000000000..c5812256ce
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_3_1.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_3_2.png b/resources/g2/track/bm/steep_to_flat_up_diag_3_2.png
new file mode 100644
index 0000000000..1f53d098cc
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_3_2.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_3_3.png b/resources/g2/track/bm/steep_to_flat_up_diag_3_3.png
new file mode 100644
index 0000000000..0c3ab55bb3
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_3_3.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_4_1.png b/resources/g2/track/bm/steep_to_flat_up_diag_4_1.png
new file mode 100644
index 0000000000..a24caad65b
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_4_1.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_4_2.png b/resources/g2/track/bm/steep_to_flat_up_diag_4_2.png
new file mode 100644
index 0000000000..19a700bfdf
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_4_2.png differ
diff --git a/resources/g2/track/bm/steep_to_flat_up_diag_4_3.png b/resources/g2/track/bm/steep_to_flat_up_diag_4_3.png
new file mode 100644
index 0000000000..4136a1e253
Binary files /dev/null and b/resources/g2/track/bm/steep_to_flat_up_diag_4_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_1_1.png b/resources/g2/track/corkscrew/dive_loop_45_left_1_1.png
new file mode 100644
index 0000000000..8cb5ff2ef5
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_1_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_1_2.png b/resources/g2/track/corkscrew/dive_loop_45_left_1_2.png
new file mode 100644
index 0000000000..0e2391b7a9
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_1_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_1_3.png b/resources/g2/track/corkscrew/dive_loop_45_left_1_3.png
new file mode 100644
index 0000000000..af3bf6b616
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_1_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_1_4.png b/resources/g2/track/corkscrew/dive_loop_45_left_1_4.png
new file mode 100644
index 0000000000..45ffb1e032
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_1_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_2_1.png b/resources/g2/track/corkscrew/dive_loop_45_left_2_1.png
new file mode 100644
index 0000000000..6625048328
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_2_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_2_2.png b/resources/g2/track/corkscrew/dive_loop_45_left_2_2.png
new file mode 100644
index 0000000000..5dcb878c5e
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_2_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_2_3.png b/resources/g2/track/corkscrew/dive_loop_45_left_2_3.png
new file mode 100644
index 0000000000..aba3d35f88
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_2_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_2_4.png b/resources/g2/track/corkscrew/dive_loop_45_left_2_4.png
new file mode 100644
index 0000000000..ccfa253960
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_2_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_3_1.png b/resources/g2/track/corkscrew/dive_loop_45_left_3_1.png
new file mode 100644
index 0000000000..612d1f22df
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_3_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_3_2.png b/resources/g2/track/corkscrew/dive_loop_45_left_3_2.png
new file mode 100644
index 0000000000..803a116aa9
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_3_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_3_3.png b/resources/g2/track/corkscrew/dive_loop_45_left_3_3.png
new file mode 100644
index 0000000000..c04d7b2576
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_3_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_3_4.png b/resources/g2/track/corkscrew/dive_loop_45_left_3_4.png
new file mode 100644
index 0000000000..f1c32079a2
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_3_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_4_1.png b/resources/g2/track/corkscrew/dive_loop_45_left_4_1.png
new file mode 100644
index 0000000000..1a3dc4d0d7
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_4_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_4_2.png b/resources/g2/track/corkscrew/dive_loop_45_left_4_2.png
new file mode 100644
index 0000000000..250848444f
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_4_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_4_3.png b/resources/g2/track/corkscrew/dive_loop_45_left_4_3.png
new file mode 100644
index 0000000000..aa78cfc363
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_4_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_left_4_4.png b/resources/g2/track/corkscrew/dive_loop_45_left_4_4.png
new file mode 100644
index 0000000000..7d26dd6729
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_left_4_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_1_1.png b/resources/g2/track/corkscrew/dive_loop_45_right_1_1.png
new file mode 100644
index 0000000000..445b0bb646
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_1_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_1_2.png b/resources/g2/track/corkscrew/dive_loop_45_right_1_2.png
new file mode 100644
index 0000000000..815a430ded
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_1_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_1_3.png b/resources/g2/track/corkscrew/dive_loop_45_right_1_3.png
new file mode 100644
index 0000000000..2622af83ff
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_1_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_1_4.png b/resources/g2/track/corkscrew/dive_loop_45_right_1_4.png
new file mode 100644
index 0000000000..1bfff83e6c
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_1_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_2_1.png b/resources/g2/track/corkscrew/dive_loop_45_right_2_1.png
new file mode 100644
index 0000000000..e315319b6a
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_2_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_2_2.png b/resources/g2/track/corkscrew/dive_loop_45_right_2_2.png
new file mode 100644
index 0000000000..d7d8c5cd83
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_2_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_2_3.png b/resources/g2/track/corkscrew/dive_loop_45_right_2_3.png
new file mode 100644
index 0000000000..71ea002df3
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_2_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_2_4.png b/resources/g2/track/corkscrew/dive_loop_45_right_2_4.png
new file mode 100644
index 0000000000..85981cc046
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_2_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_3_1.png b/resources/g2/track/corkscrew/dive_loop_45_right_3_1.png
new file mode 100644
index 0000000000..5215a11f80
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_3_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_3_2.png b/resources/g2/track/corkscrew/dive_loop_45_right_3_2.png
new file mode 100644
index 0000000000..97aa99080f
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_3_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_3_3.png b/resources/g2/track/corkscrew/dive_loop_45_right_3_3.png
new file mode 100644
index 0000000000..e31fec77d1
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_3_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_3_4.png b/resources/g2/track/corkscrew/dive_loop_45_right_3_4.png
new file mode 100644
index 0000000000..f492fbd7f8
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_3_4.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_4_1.png b/resources/g2/track/corkscrew/dive_loop_45_right_4_1.png
new file mode 100644
index 0000000000..5c98c16bee
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_4_1.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_4_2.png b/resources/g2/track/corkscrew/dive_loop_45_right_4_2.png
new file mode 100644
index 0000000000..0c58e41a72
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_4_2.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_4_3.png b/resources/g2/track/corkscrew/dive_loop_45_right_4_3.png
new file mode 100644
index 0000000000..553f56cadd
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_4_3.png differ
diff --git a/resources/g2/track/corkscrew/dive_loop_45_right_4_4.png b/resources/g2/track/corkscrew/dive_loop_45_right_4_4.png
new file mode 100644
index 0000000000..43d6268eaa
Binary files /dev/null and b/resources/g2/track/corkscrew/dive_loop_45_right_4_4.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_1.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_1.png
new file mode 100644
index 0000000000..561925a0d3
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_1.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_2.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_2.png
new file mode 100644
index 0000000000..176eb715e6
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_2.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_3.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_3.png
new file mode 100644
index 0000000000..541356ccd9
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_1_3.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_1.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_1.png
new file mode 100644
index 0000000000..b6b6198aa5
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_1.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_2.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_2.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_3.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_3.png
new file mode 100644
index 0000000000..bc433a3f14
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_2_3.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_1.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_1.png
new file mode 100644
index 0000000000..6b6b25fdb2
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_1.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_2.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_2.png
new file mode 100644
index 0000000000..ee37da31e1
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_2.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_3.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_3.png
new file mode 100644
index 0000000000..4deb0d906b
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_3_3.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_1.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_1.png
new file mode 100644
index 0000000000..a41f1609f9
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_1.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_2.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_2.png
new file mode 100644
index 0000000000..2faff9e99e
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_2.png differ
diff --git a/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_3.png b/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_3.png
new file mode 100644
index 0000000000..1cbc517eb4
Binary files /dev/null and b/resources/g2/track/corkscrew/flat_to_steep_up_diag_4_3.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_1.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_1.png
new file mode 100644
index 0000000000..1623eae794
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_1.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_2.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_2.png
new file mode 100644
index 0000000000..988fe0305a
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_2.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_3.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_3.png
new file mode 100644
index 0000000000..fa3c5cf89c
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_1_3.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_1.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_1.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_1.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_2.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_2.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_3.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_3.png
new file mode 100644
index 0000000000..a067ad3ab1
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_2_3.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_1.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_1.png
new file mode 100644
index 0000000000..7fc02542b0
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_1.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_2.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_2.png
new file mode 100644
index 0000000000..c14b9af2cf
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_2.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_3.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_3.png
new file mode 100644
index 0000000000..ee64cfc951
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_3_3.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_1.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_1.png
new file mode 100644
index 0000000000..470d05a186
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_1.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_2.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_2.png
new file mode 100644
index 0000000000..7799b7031e
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_2.png differ
diff --git a/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_3.png b/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_3.png
new file mode 100644
index 0000000000..f477d80e44
Binary files /dev/null and b/resources/g2/track/corkscrew/steep_to_flat_up_diag_4_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_1_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_1.png
new file mode 100644
index 0000000000..8f478d8ef6
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_1_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_2.png
new file mode 100644
index 0000000000..aa24fdf9b5
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_1_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_3.png
new file mode 100644
index 0000000000..1c684f2260
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_1_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_4.png
new file mode 100644
index 0000000000..f8a81dd2e5
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_1_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_2_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_1.png
new file mode 100644
index 0000000000..97f8ef0234
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_2_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_2.png
new file mode 100644
index 0000000000..42264ab4a3
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_2_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_3.png
new file mode 100644
index 0000000000..df3f24391a
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_2_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_4.png
new file mode 100644
index 0000000000..b035c0167a
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_2_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_3_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_1.png
new file mode 100644
index 0000000000..e4f8f78fe7
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_3_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_2.png
new file mode 100644
index 0000000000..a8eef697af
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_3_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_3.png
new file mode 100644
index 0000000000..c03c8c6dc6
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_3_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_4.png
new file mode 100644
index 0000000000..2977332e8c
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_3_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_4_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_1.png
new file mode 100644
index 0000000000..a1d06ce79d
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_4_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_2.png
new file mode 100644
index 0000000000..d464f23ca1
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_4_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_3.png
new file mode 100644
index 0000000000..8ae8b59d8e
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_left_4_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_4.png
new file mode 100644
index 0000000000..75f652c5f1
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_left_4_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_1_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_1.png
new file mode 100644
index 0000000000..4ca2ebb0d7
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_1_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_2.png
new file mode 100644
index 0000000000..72c3c7da5c
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_1_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_3.png
new file mode 100644
index 0000000000..60de80df48
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_1_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_4.png
new file mode 100644
index 0000000000..a2e1a7cbe6
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_1_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_2_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_1.png
new file mode 100644
index 0000000000..4a0e3770aa
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_2_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_2.png
new file mode 100644
index 0000000000..4e00758aeb
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_2_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_3.png
new file mode 100644
index 0000000000..ede5b32f5e
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_2_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_4.png
new file mode 100644
index 0000000000..ad075d87fc
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_2_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_3_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_1.png
new file mode 100644
index 0000000000..885e484993
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_3_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_2.png
new file mode 100644
index 0000000000..8bb2351a92
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_3_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_3.png
new file mode 100644
index 0000000000..9554ebd3da
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_3_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_4.png
new file mode 100644
index 0000000000..fe27833ff3
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_3_4.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_4_1.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_1.png
new file mode 100644
index 0000000000..f12d14010f
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_1.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_4_2.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_2.png
new file mode 100644
index 0000000000..d7e1a292de
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_2.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_4_3.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_3.png
new file mode 100644
index 0000000000..d2359800f7
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_3.png differ
diff --git a/resources/g2/track/lattice_triangle/dive_loop_45_right_4_4.png b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_4.png
new file mode 100644
index 0000000000..f36c597135
Binary files /dev/null and b/resources/g2/track/lattice_triangle/dive_loop_45_right_4_4.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1.png
new file mode 100644
index 0000000000..2baabe084f
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_1.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_1.png
new file mode 100644
index 0000000000..d669dd9f97
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_1.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_2.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_2.png
new file mode 100644
index 0000000000..1b3643c62d
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_2.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_3.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_3.png
new file mode 100644
index 0000000000..3f5b5456fe
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_1_3.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2.png
new file mode 100644
index 0000000000..0ba5517dfc
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_1.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_1.png
new file mode 100644
index 0000000000..463e2bfc6d
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_1.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_2.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_2.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_3.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_3.png
new file mode 100644
index 0000000000..e9e5ab4309
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_2_3.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3.png
new file mode 100644
index 0000000000..4010677473
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_1.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_1.png
new file mode 100644
index 0000000000..0ba55b01cb
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_1.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_2.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_2.png
new file mode 100644
index 0000000000..614d2f09e8
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_2.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_3.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_3.png
new file mode 100644
index 0000000000..5b93eac8cb
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_3_3.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4.png
new file mode 100644
index 0000000000..c2e8c0ec08
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_1.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_1.png
new file mode 100644
index 0000000000..38cdae0ad1
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_1.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_2.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_2.png
new file mode 100644
index 0000000000..3e7a847eef
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_2.png differ
diff --git a/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_3.png b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_3.png
new file mode 100644
index 0000000000..3fbe6d2fdc
Binary files /dev/null and b/resources/g2/track/lattice_triangle/flat_to_steep_up_diag_4_3.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1.png
new file mode 100644
index 0000000000..9d9a5293b3
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_1.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_1.png
new file mode 100644
index 0000000000..d8b6a5e1ed
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_1.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_2.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_2.png
new file mode 100644
index 0000000000..794989b338
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_2.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_3.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_3.png
new file mode 100644
index 0000000000..008b824b96
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_1_3.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2.png
new file mode 100644
index 0000000000..89adb42c83
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_1.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_1.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_1.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_2.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_2.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_3.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_3.png
new file mode 100644
index 0000000000..65e0af16ce
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_2_3.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3.png
new file mode 100644
index 0000000000..902291d2d1
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_1.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_1.png
new file mode 100644
index 0000000000..5ee268aa98
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_1.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_2.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_2.png
new file mode 100644
index 0000000000..74fe35a864
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_2.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_3.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_3.png
new file mode 100644
index 0000000000..aa5ab044ca
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_3_3.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4.png
new file mode 100644
index 0000000000..25ef9abfc1
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_1.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_1.png
new file mode 100644
index 0000000000..0565b4a0f8
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_1.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_2.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_2.png
new file mode 100644
index 0000000000..03774bfe05
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_2.png differ
diff --git a/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_3.png b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_3.png
new file mode 100644
index 0000000000..f86d6d448e
Binary files /dev/null and b/resources/g2/track/lattice_triangle/steep_to_flat_up_diag_4_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_1_1.png b/resources/g2/track/raptor/dive_loop_45_left_1_1.png
new file mode 100644
index 0000000000..5d2f718d29
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_1_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_1_2.png b/resources/g2/track/raptor/dive_loop_45_left_1_2.png
new file mode 100644
index 0000000000..484709162c
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_1_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_1_3.png b/resources/g2/track/raptor/dive_loop_45_left_1_3.png
new file mode 100644
index 0000000000..9bb92939ff
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_1_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_1_4.png b/resources/g2/track/raptor/dive_loop_45_left_1_4.png
new file mode 100644
index 0000000000..0e11cee76e
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_1_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_2_1.png b/resources/g2/track/raptor/dive_loop_45_left_2_1.png
new file mode 100644
index 0000000000..4a0e419411
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_2_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_2_2.png b/resources/g2/track/raptor/dive_loop_45_left_2_2.png
new file mode 100644
index 0000000000..02e1c54b82
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_2_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_2_3.png b/resources/g2/track/raptor/dive_loop_45_left_2_3.png
new file mode 100644
index 0000000000..6519f9d6a9
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_2_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_2_4.png b/resources/g2/track/raptor/dive_loop_45_left_2_4.png
new file mode 100644
index 0000000000..3db7ea3e7c
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_2_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_3_1.png b/resources/g2/track/raptor/dive_loop_45_left_3_1.png
new file mode 100644
index 0000000000..7e7cfdc974
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_3_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_3_2.png b/resources/g2/track/raptor/dive_loop_45_left_3_2.png
new file mode 100644
index 0000000000..4d8b636b46
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_3_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_3_3.png b/resources/g2/track/raptor/dive_loop_45_left_3_3.png
new file mode 100644
index 0000000000..1f6f884952
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_3_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_3_4.png b/resources/g2/track/raptor/dive_loop_45_left_3_4.png
new file mode 100644
index 0000000000..5de1d63638
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_3_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_4_1.png b/resources/g2/track/raptor/dive_loop_45_left_4_1.png
new file mode 100644
index 0000000000..abc870d056
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_4_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_4_2.png b/resources/g2/track/raptor/dive_loop_45_left_4_2.png
new file mode 100644
index 0000000000..cbd0950af1
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_4_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_4_3.png b/resources/g2/track/raptor/dive_loop_45_left_4_3.png
new file mode 100644
index 0000000000..06dc35064f
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_4_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_left_4_4.png b/resources/g2/track/raptor/dive_loop_45_left_4_4.png
new file mode 100644
index 0000000000..3054197c87
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_left_4_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_1_1.png b/resources/g2/track/raptor/dive_loop_45_right_1_1.png
new file mode 100644
index 0000000000..6b5fa23877
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_1_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_1_2.png b/resources/g2/track/raptor/dive_loop_45_right_1_2.png
new file mode 100644
index 0000000000..6ebae3dff6
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_1_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_1_3.png b/resources/g2/track/raptor/dive_loop_45_right_1_3.png
new file mode 100644
index 0000000000..138b7647bc
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_1_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_1_4.png b/resources/g2/track/raptor/dive_loop_45_right_1_4.png
new file mode 100644
index 0000000000..5cdf7ef0be
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_1_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_2_1.png b/resources/g2/track/raptor/dive_loop_45_right_2_1.png
new file mode 100644
index 0000000000..cb3af11960
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_2_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_2_2.png b/resources/g2/track/raptor/dive_loop_45_right_2_2.png
new file mode 100644
index 0000000000..c46bbdea77
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_2_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_2_3.png b/resources/g2/track/raptor/dive_loop_45_right_2_3.png
new file mode 100644
index 0000000000..09dccfb770
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_2_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_2_4.png b/resources/g2/track/raptor/dive_loop_45_right_2_4.png
new file mode 100644
index 0000000000..d9eeeb4957
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_2_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_3_1.png b/resources/g2/track/raptor/dive_loop_45_right_3_1.png
new file mode 100644
index 0000000000..6821ff11d0
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_3_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_3_2.png b/resources/g2/track/raptor/dive_loop_45_right_3_2.png
new file mode 100644
index 0000000000..4c5493434b
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_3_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_3_3.png b/resources/g2/track/raptor/dive_loop_45_right_3_3.png
new file mode 100644
index 0000000000..13a4d7fd7e
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_3_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_3_4.png b/resources/g2/track/raptor/dive_loop_45_right_3_4.png
new file mode 100644
index 0000000000..5fa7251e3a
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_3_4.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_4_1.png b/resources/g2/track/raptor/dive_loop_45_right_4_1.png
new file mode 100644
index 0000000000..cea656296e
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_4_1.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_4_2.png b/resources/g2/track/raptor/dive_loop_45_right_4_2.png
new file mode 100644
index 0000000000..8898578c76
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_4_2.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_4_3.png b/resources/g2/track/raptor/dive_loop_45_right_4_3.png
new file mode 100644
index 0000000000..8a834884b8
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_4_3.png differ
diff --git a/resources/g2/track/raptor/dive_loop_45_right_4_4.png b/resources/g2/track/raptor/dive_loop_45_right_4_4.png
new file mode 100644
index 0000000000..75608f1f57
Binary files /dev/null and b/resources/g2/track/raptor/dive_loop_45_right_4_4.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_1_1.png b/resources/g2/track/raptor/flat_to_steep_up_diag_1_1.png
new file mode 100644
index 0000000000..ff14b77d7a
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_1_1.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_1_2.png b/resources/g2/track/raptor/flat_to_steep_up_diag_1_2.png
new file mode 100644
index 0000000000..f7e40fe3f9
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_1_2.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_1_3.png b/resources/g2/track/raptor/flat_to_steep_up_diag_1_3.png
new file mode 100644
index 0000000000..3c78b4c5ba
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_1_3.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_2_1.png b/resources/g2/track/raptor/flat_to_steep_up_diag_2_1.png
new file mode 100644
index 0000000000..3da2ad8e69
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_2_1.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_2_2.png b/resources/g2/track/raptor/flat_to_steep_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_2_2.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_2_3.png b/resources/g2/track/raptor/flat_to_steep_up_diag_2_3.png
new file mode 100644
index 0000000000..3f240a661b
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_2_3.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_3_1.png b/resources/g2/track/raptor/flat_to_steep_up_diag_3_1.png
new file mode 100644
index 0000000000..8a1cb8df81
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_3_1.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_3_2.png b/resources/g2/track/raptor/flat_to_steep_up_diag_3_2.png
new file mode 100644
index 0000000000..a53813c501
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_3_2.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_3_3.png b/resources/g2/track/raptor/flat_to_steep_up_diag_3_3.png
new file mode 100644
index 0000000000..76d7fcb7a2
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_3_3.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_4_1.png b/resources/g2/track/raptor/flat_to_steep_up_diag_4_1.png
new file mode 100644
index 0000000000..1ee8c16476
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_4_1.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_4_2.png b/resources/g2/track/raptor/flat_to_steep_up_diag_4_2.png
new file mode 100644
index 0000000000..89da8414eb
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_4_2.png differ
diff --git a/resources/g2/track/raptor/flat_to_steep_up_diag_4_3.png b/resources/g2/track/raptor/flat_to_steep_up_diag_4_3.png
new file mode 100644
index 0000000000..cafb747651
Binary files /dev/null and b/resources/g2/track/raptor/flat_to_steep_up_diag_4_3.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_1_1.png b/resources/g2/track/raptor/steep_to_flat_up_diag_1_1.png
new file mode 100644
index 0000000000..4f3d08defc
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_1_1.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_1_2.png b/resources/g2/track/raptor/steep_to_flat_up_diag_1_2.png
new file mode 100644
index 0000000000..5a26edb65a
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_1_2.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_1_3.png b/resources/g2/track/raptor/steep_to_flat_up_diag_1_3.png
new file mode 100644
index 0000000000..b888b93b16
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_1_3.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_2_1.png b/resources/g2/track/raptor/steep_to_flat_up_diag_2_1.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_2_1.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_2_2.png b/resources/g2/track/raptor/steep_to_flat_up_diag_2_2.png
new file mode 100644
index 0000000000..251476d353
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_2_2.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_2_3.png b/resources/g2/track/raptor/steep_to_flat_up_diag_2_3.png
new file mode 100644
index 0000000000..66f30a8b96
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_2_3.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_3_1.png b/resources/g2/track/raptor/steep_to_flat_up_diag_3_1.png
new file mode 100644
index 0000000000..374d1edd6b
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_3_1.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_3_2.png b/resources/g2/track/raptor/steep_to_flat_up_diag_3_2.png
new file mode 100644
index 0000000000..07931052a5
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_3_2.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_3_3.png b/resources/g2/track/raptor/steep_to_flat_up_diag_3_3.png
new file mode 100644
index 0000000000..5c67bcb43d
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_3_3.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_4_1.png b/resources/g2/track/raptor/steep_to_flat_up_diag_4_1.png
new file mode 100644
index 0000000000..9885f187c3
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_4_1.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_4_2.png b/resources/g2/track/raptor/steep_to_flat_up_diag_4_2.png
new file mode 100644
index 0000000000..39de02f4ae
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_4_2.png differ
diff --git a/resources/g2/track/raptor/steep_to_flat_up_diag_4_3.png b/resources/g2/track/raptor/steep_to_flat_up_diag_4_3.png
new file mode 100644
index 0000000000..4d57c5bf00
Binary files /dev/null and b/resources/g2/track/raptor/steep_to_flat_up_diag_4_3.png differ
diff --git a/scripts/build-emscripten b/scripts/build-emscripten
new file mode 100755
index 0000000000..d85c3cf4fe
--- /dev/null
+++ b/scripts/build-emscripten
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+mkdir -p build
+cd build
+
+START_DIR=$(pwd)
+SPEEXDSP_ROOT=/ext/speexdsp
+ICU_ROOT=/ext/icu/icu4c/source
+LIBZIP_ROOT=/ext/libzip
+JSON_DIR=/usr/include/nlohmann/
+
+emcmake cmake ../ \
+ -G Ninja \
+ -DDISABLE_NETWORK=ON \
+ -DDISABLE_HTTP=ON \
+ -DDISABLE_TTF=ON \
+ -DDISABLE_FLAC=ON \
+ -DDISABLE_DISCORD_RPC=ON \
+ -DCMAKE_SYSTEM_NAME=Emscripten \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DSPEEXDSP_INCLUDE_DIR="$SPEEXDSP_ROOT/include/" \
+ -DSPEEXDSP_LIBRARY="$SPEEXDSP_ROOT/libspeexdsp/.libs/libspeexdsp.a" \
+ -DICU_INCLUDE_DIR="$ICU_ROOT/common" \
+ -DICU_DATA_LIBRARIES=$ICU_ROOT/lib/libicuuc.so \
+ -DICU_DT_LIBRARY_RELEASE="$ICU_ROOT/stubdata/libicudata.so" \
+ -DLIBZIP_LIBRARIES="$LIBZIP_ROOT/build/lib/libzip.a" \
+ -DEMSCRIPTEN_FLAGS="-s USE_SDL=2 -s USE_BZIP2=1 -s USE_LIBPNG=1 -pthread -O3" \
+ -DEMSCRIPTEN_LDFLAGS="-Wno-pthreads-mem-growth -s ASYNCIFY -s FULL_ES3 -s SAFE_HEAP=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s INITIAL_MEMORY=2GB -s MAX_WEBGL_VERSION=2 -s PTHREAD_POOL_SIZE=120 -pthread -sEXPORTED_RUNTIME_METHODS=ccall,FS,callMain,UTF8ToString,stringToNewUTF8 -lidbfs.js --use-preload-plugins -s MODULARIZE=1 -s 'EXPORT_NAME=\"OPENRCT2_WEB\"'"
+
+emmake ninja
+
+rm -rf www/
+mkdir -p www/
+cd www/
+cp -r ../openrct2.* ./
+cp -r ../../emscripten/static/* ./
diff --git a/src/openrct2-cli/CMakeLists.txt b/src/openrct2-cli/CMakeLists.txt
index 0c0d258704..53c4677d57 100644
--- a/src/openrct2-cli/CMakeLists.txt
+++ b/src/openrct2-cli/CMakeLists.txt
@@ -17,5 +17,8 @@ file(GLOB_RECURSE OPENRCT2_CLI_SOURCES
add_executable(${PROJECT_NAME} ${OPENRCT2_CLI_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/..")
ipo_set_target_properties(${PROJECT_NAME})
+if (EMSCRIPTEN)
+ target_link_libraries(${PROJECT_NAME} ${ICU_DT_LIBRARY_RELEASE} ${ICU_DATA_LIBRARIES})
+endif ()
target_link_libraries(${PROJECT_NAME} libopenrct2 Threads::Threads)
target_link_platform_libraries(${PROJECT_NAME})
diff --git a/src/openrct2-ui/CMakeLists.txt b/src/openrct2-ui/CMakeLists.txt
index d98a5a159f..93b498abbb 100644
--- a/src/openrct2-ui/CMakeLists.txt
+++ b/src/openrct2-ui/CMakeLists.txt
@@ -11,7 +11,16 @@ option(DISABLE_VORBIS "Disable OGG/VORBIS support.")
option(DISABLE_OPENGL "Disable OpenGL support.")
# Third party libraries
-if (MSVC)
+if (EMSCRIPTEN)
+ set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
+ if (NOT DISABLE_VORBIS)
+ set(USE_FLAGS "${USE_FLAGS} -s USE_VORBIS=1 -s USE_OGG=1")
+ endif ()
+ set(SHARED_FLAGS "-fexceptions")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS} -s EXPORTED_FUNCTIONS=_GetVersion,_main --js-library ${ROOT_DIR}/emscripten/deps.js")
+ find_package(SpeexDSP REQUIRED)
+elseif (MSVC)
find_package(SDL2 REQUIRED)
find_library(SPEEX_LDFLAGS libspeexdsp)
if (NOT DISABLE_FLAC)
@@ -33,7 +42,7 @@ else ()
endif ()
endif ()
-if (NOT DISABLE_OPENGL)
+if (NOT DISABLE_OPENGL AND NOT EMSCRIPTEN)
# GL doesn't work nicely with macOS, while find_package doesn't work with multiarch on Ubuntu.
if (APPLE)
find_package(OpenGL REQUIRED)
@@ -61,7 +70,12 @@ SET_CHECK_CXX_FLAGS(${PROJECT_NAME})
ipo_set_target_properties(${PROJECT_NAME})
# mingw builds cannot use the PkgConfig imported targets
-if (NOT MSVC AND NOT WIN32)
+if (EMSCRIPTEN)
+ target_link_libraries(${PROJECT_NAME} "libopenrct2"
+ ${SPEEXDSP_LIBRARIES}
+ ${ICU_DATA_LIBRARIES}
+ ${ICU_DT_LIBRARY_RELEASE})
+elseif (NOT MSVC AND NOT WIN32)
target_link_libraries(${PROJECT_NAME} "libopenrct2"
PkgConfig::SDL2
PkgConfig::SPEEX)
@@ -81,7 +95,7 @@ if (NOT DISABLE_FLAC)
endif ()
if (NOT DISABLE_VORBIS)
- if (NOT MSVC AND NOT WIN32)
+ if (NOT MSVC AND NOT WIN32 AND NOT EMSCRIPTEN)
target_link_libraries(${PROJECT_NAME} PkgConfig::OGG PkgConfig::VORBISFILE)
else ()
target_link_libraries(${PROJECT_NAME} ${OGG_LDFLAGS} ${VORBISFILE_LDFLAGS})
diff --git a/src/openrct2-ui/CursorData.cpp b/src/openrct2-ui/CursorData.cpp
index 425061a91a..1e583e7c76 100644
--- a/src/openrct2-ui/CursorData.cpp
+++ b/src/openrct2-ui/CursorData.cpp
@@ -15,9 +15,9 @@
namespace OpenRCT2::Ui
{
- constexpr char rawTransparent = ' ';
- constexpr char rawWhite = '.';
- constexpr char rawBlack = 'X';
+ constexpr char kRawTransparent = ' ';
+ constexpr char kRawWhite = '.';
+ constexpr char kRawBlack = 'X';
constexpr static CursorData cursorFromBitMap(int x, int y, std::string_view bitmap)
{
@@ -35,15 +35,15 @@ namespace OpenRCT2::Ui
uint8_t dataBit{}, maskBit{};
switch (rawPixel)
{
- case rawBlack:
+ case kRawBlack:
dataBit = 1;
maskBit = 1;
break;
- case rawWhite:
+ case kRawWhite:
dataBit = 0;
maskBit = 1;
break;
- case rawTransparent:
+ case kRawTransparent:
dataBit = 0;
maskBit = 0;
break;
@@ -947,7 +947,7 @@ namespace OpenRCT2::Ui
" X.X "
" X ");
- static constexpr const CursorData* RawCursorData[] = {
+ static constexpr const CursorData* kRawCursorData[] = {
nullptr, // CursorID::Arrow
&kBlankCursorData, // CursorID::Blank
&kUpArrowCursorData, // CursorID::UpArrow
@@ -983,7 +983,7 @@ namespace OpenRCT2::Ui
const CursorData* result = nullptr;
if (cursorId != CursorID::Undefined && cursorId != CursorID::Count)
{
- result = RawCursorData[EnumValue(cursorId)];
+ result = kRawCursorData[EnumValue(cursorId)];
}
return result;
}
diff --git a/src/openrct2-ui/ProvisionalElements.cpp b/src/openrct2-ui/ProvisionalElements.cpp
index 5b4b643c0f..14584c9174 100644
--- a/src/openrct2-ui/ProvisionalElements.cpp
+++ b/src/openrct2-ui/ProvisionalElements.cpp
@@ -9,12 +9,14 @@
#include "ProvisionalElements.h"
-#include
+#include
+#include
#include
#include
#include
#include
#include
+#include
#include
using namespace OpenRCT2::Ui::Windows;
@@ -27,14 +29,15 @@ namespace OpenRCT2::Ui
FootpathRemoveProvisionalTemporarily();
- if (WindowFindByClass(WindowClass::RideConstruction) != nullptr)
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByClass(WindowClass::RideConstruction) != nullptr)
{
RideRemoveProvisionalTrackPiece();
RideEntranceExitRemoveGhost();
}
// This is in non performant so only make network games suffer for it
// non networked games do not need this as its to prevent desyncs.
- if ((NetworkGetMode() != NETWORK_MODE_NONE) && WindowFindByClass(WindowClass::TrackDesignPlace) != nullptr)
+ if ((NetworkGetMode() != NETWORK_MODE_NONE) && windowMgr->FindByClass(WindowClass::TrackDesignPlace) != nullptr)
{
TrackPlaceClearProvisionalTemporarily();
}
@@ -46,14 +49,15 @@ namespace OpenRCT2::Ui
FootpathRestoreProvisional();
- if (WindowFindByClass(WindowClass::RideConstruction) != nullptr)
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByClass(WindowClass::RideConstruction) != nullptr)
{
RideRestoreProvisionalTrackPiece();
RideEntranceExitPlaceProvisionalGhost();
}
// This is in non performant so only make network games suffer for it
// non networked games do not need this as its to prevent desyncs.
- if ((NetworkGetMode() != NETWORK_MODE_NONE) && WindowFindByClass(WindowClass::TrackDesignPlace) != nullptr)
+ if ((NetworkGetMode() != NETWORK_MODE_NONE) && windowMgr->FindByClass(WindowClass::TrackDesignPlace) != nullptr)
{
TrackPlaceRestoreProvisional();
}
diff --git a/src/openrct2-ui/TextComposition.cpp b/src/openrct2-ui/TextComposition.cpp
index 55bbf7eeb9..3b59e59222 100644
--- a/src/openrct2-ui/TextComposition.cpp
+++ b/src/openrct2-ui/TextComposition.cpp
@@ -12,12 +12,14 @@
#include "UiContext.h"
#include "UiStringIds.h"
#include "interface/InGameConsole.h"
+#include "interface/Window.h"
#include
-#include
+#include
#include
#include
#include
+#include
#ifdef __MACOSX__
// macOS uses COMMAND rather than CTRL for many keyboard shortcuts
@@ -170,8 +172,8 @@ void TextComposition::HandleMessage(const SDL_Event* e)
case SDLK_c:
if ((modifier & KEYBOARD_PRIMARY_MODIFIER) && _session.Length)
{
- SDL_SetClipboardText(_session.Buffer->c_str());
- ContextShowError(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE, {});
+ OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(_session.Buffer->c_str());
+ ContextShowError(STR_COPY_INPUT_TO_CLIPBOARD, kStringIdNone, {});
}
break;
case SDLK_v:
diff --git a/src/openrct2-ui/TextComposition.h b/src/openrct2-ui/TextComposition.h
index ef4e37db87..ddad7f1deb 100644
--- a/src/openrct2-ui/TextComposition.h
+++ b/src/openrct2-ui/TextComposition.h
@@ -10,7 +10,6 @@
#pragma once
#include
-#include
union SDL_Event;
diff --git a/src/openrct2-ui/Ui.cpp b/src/openrct2-ui/Ui.cpp
index 2674fa7528..214fbe15f6 100644
--- a/src/openrct2-ui/Ui.cpp
+++ b/src/openrct2-ui/Ui.cpp
@@ -24,6 +24,10 @@
#include
#include
+#ifdef __EMSCRIPTEN__
+ #include
+#endif
+
using namespace OpenRCT2;
using namespace OpenRCT2::Audio;
using namespace OpenRCT2::Ui;
@@ -43,6 +47,12 @@ int NormalisedMain(int argc, const char** argv)
int main(int argc, const char** argv)
#endif
{
+#ifdef __EMSCRIPTEN__
+ MAIN_THREAD_EM_ASM({
+ specialHTMLTargets["!canvas"] = Module.canvas;
+ Module.canvas.addEventListener("contextmenu", function(e) { e.preventDefault(); });
+ });
+#endif
std::unique_ptr context;
int32_t rc = EXIT_SUCCESS;
int runGame = CommandLineRun(argv, argc);
diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp
index ba0d4b829a..5bae0b072b 100644
--- a/src/openrct2-ui/UiContext.Linux.cpp
+++ b/src/openrct2-ui/UiContext.Linux.cpp
@@ -27,6 +27,10 @@
#include
#include
+ #ifdef __EMSCRIPTEN__
+ #include
+ #endif
+
namespace OpenRCT2::Ui
{
enum class DIALOG_TYPE
@@ -129,8 +133,12 @@ namespace OpenRCT2::Ui
void OpenURL(const std::string& url) override
{
+ #ifndef __EMSCRIPTEN__
std::string cmd = String::stdFormat("xdg-open %s", url.c_str());
Platform::Execute(cmd);
+ #else
+ MAIN_THREAD_EM_ASM({ window.open(UTF8ToString($0)); }, url.c_str());
+ #endif
}
std::string ShowFileDialog(SDL_Window* window, const FileDialogDesc& desc) override
diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp
index a82df5109c..e724c685d6 100644
--- a/src/openrct2-ui/UiContext.cpp
+++ b/src/openrct2-ui/UiContext.cpp
@@ -18,6 +18,7 @@
#include "input/ShortcutManager.h"
#include "interface/InGameConsole.h"
#include "interface/Theme.h"
+#include "interface/Viewport.h"
#include "scripting/UiExtensions.h"
#include "title/TitleSequencePlayer.h"
@@ -40,7 +41,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -49,6 +49,11 @@
#include
#include
+#ifdef __EMSCRIPTEN__
+ #include
+ #include
+#endif
+
using namespace OpenRCT2;
using namespace OpenRCT2::Drawing;
using namespace OpenRCT2::Scripting;
@@ -64,7 +69,7 @@ using namespace OpenRCT2::Ui;
class UiContext final : public IUiContext
{
private:
- constexpr static uint32_t TOUCH_DOUBLE_TIMEOUT = 300;
+ constexpr static uint32_t kTouchDoubleTimeout = 300;
const std::unique_ptr _platformUiContext;
const std::unique_ptr _windowManager;
@@ -177,12 +182,12 @@ public:
void SetFullscreenMode(FULLSCREEN_MODE mode) override
{
- static constexpr int32_t _sdlFullscreenFlags[] = {
+ static constexpr int32_t kSDLFullscreenFlags[] = {
0,
SDL_WINDOW_FULLSCREEN,
SDL_WINDOW_FULLSCREEN_DESKTOP,
};
- uint32_t windowFlags = _sdlFullscreenFlags[EnumValue(mode)];
+ uint32_t windowFlags = kSDLFullscreenFlags[EnumValue(mode)];
// HACK Changing window size when in fullscreen usually has no effect
if (mode == FULLSCREEN_MODE::FULLSCREEN)
@@ -476,7 +481,7 @@ public:
_cursorState.touchIsDouble
= (!_cursorState.touchIsDouble
- && e.tfinger.timestamp - _cursorState.touchDownTimestamp < TOUCH_DOUBLE_TIMEOUT);
+ && e.tfinger.timestamp - _cursorState.touchDownTimestamp < kTouchDoubleTimeout);
if (_cursorState.touchIsDouble)
{
@@ -713,7 +718,25 @@ public:
bool SetClipboardText(const utf8* target) override
{
+#ifndef __EMSCRIPTEN__
return (SDL_SetClipboardText(target) == 0);
+#else
+ return (
+ MAIN_THREAD_EM_ASM_INT(
+ {
+ try
+ {
+ navigator.clipboard.writeText(UTF8ToString($0));
+ return 0;
+ }
+ catch (e)
+ {
+ return -1;
+ };
+ },
+ target)
+ == 0);
+#endif
}
ITitleSequencePlayer* GetTitleSequencePlayer() override
@@ -753,9 +776,19 @@ private:
void CreateWindow(const ScreenCoordsXY& windowPos)
{
+#ifdef __EMSCRIPTEN__
+ MAIN_THREAD_EM_ASM({
+ Module.canvas.width = window.innerWidth;
+ Module.canvas.height = window.innerHeight;
+ });
+ int32_t width = 0;
+ int32_t height = 0;
+ emscripten_get_canvas_element_size("!canvas", &width, &height);
+#else
// Get saved window size
int32_t width = Config::Get().general.WindowWidth;
int32_t height = Config::Get().general.WindowHeight;
+#endif
if (width <= 0)
width = 640;
if (height <= 0)
diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h
index 58ac27ee76..13bac563a2 100644
--- a/src/openrct2-ui/UiStringIds.h
+++ b/src/openrct2-ui/UiStringIds.h
@@ -509,24 +509,8 @@ namespace OpenRCT2
STR_OBJECT_SELECTION_ALL_SOURCES_SHOWN = 6653,
STR_OBJECT_SELECTION_COMPAT_OBJECT_DESCRIPTION = 6550,
STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING = 6516,
- STR_OBJECT_SELECTION_FOOTPATHS = 3189,
- STR_OBJECT_SELECTION_FOOTPATH_RAILINGS = 6445,
- STR_OBJECT_SELECTION_FOOTPATH_SURFACES = 6444,
- STR_OBJECT_SELECTION_LARGE_SCENERY = 3186,
- STR_OBJECT_SELECTION_MUSIC = 6273,
STR_OBJECT_SELECTION_ONLY_STRINGID = 6655,
- STR_OBJECT_SELECTION_PATH_EXTRAS = 3190,
- STR_OBJECT_SELECTION_PATH_SIGNS = 3188,
- STR_OBJECT_SELECTION_PEEP_NAMES = 6675,
- STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS = 3184,
- STR_OBJECT_SELECTION_SCENERY_GROUPS = 3191,
STR_OBJECT_SELECTION_SELECTION_SIZE = 3164,
- STR_OBJECT_SELECTION_SMALL_SCENERY = 3185,
- STR_OBJECT_SELECTION_STATIONS = 6272,
- STR_OBJECT_SELECTION_TERRAIN_EDGES = 6271,
- STR_OBJECT_SELECTION_TERRAIN_SURFACES = 6270,
- STR_OBJECT_SELECTION_WALLS_FENCES = 3187,
- STR_OBJECT_SELECTION_WATER = 3193,
STR_OBJECT_SELECTION_SHOWING_N_SOURCES = 6654,
STR_OBJECT_USES_FALLBACK_IMAGES = 6515,
STR_RELOAD_OBJECT_TIP = 6613,
@@ -845,17 +829,22 @@ namespace OpenRCT2
STR_SET_LAND_TO_BE_OWNED_TIP = 3221,
// Window: LoadSave
- STR_DATE = 5374,
+ STR_DATE_COLUMN = 5374,
STR_FILEBROWSER_ACTION_NEW_FILE = 2719,
STR_FILEBROWSER_ACTION_NEW_FOLDER = 5985,
STR_FILEBROWSER_ACTION_UP = 2718,
+ STR_FILEBROWSER_CUSTOMISE_DATE = 6715,
+ STR_FILEBROWSER_CUSTOMISE_FILENAME = 6714,
+ STR_FILEBROWSER_CUSTOMISE_SIZE = 6716,
STR_FILEBROWSER_FILE_NAME_PROMPT = 2710,
+ STR_FILEBROWSER_FILE_SIZE_VALUE = 6713,
STR_FILEBROWSER_FOLDER_NAME_PROMPT = 5986,
STR_FILEBROWSER_OVERWRITE_PROMPT = 2708,
STR_FILEBROWSER_OVERWRITE_TITLE = 2709,
STR_FILEBROWSER_SAVE_BUTTON = 6712,
+ STR_FILEBROWSER_SIZE_COLUMN = 6717,
STR_FILEBROWSER_USE_SYSTEM_WINDOW = 2707,
- STR_FILENAME = 6711,
+ STR_FILENAME_LABEL = 6711,
STR_FILE_DIALOG_TITLE_INSTALL_NEW_TRACK_DESIGN = 1039,
STR_FILE_DIALOG_TITLE_LOAD_GAME = 1036,
STR_FILE_DIALOG_TITLE_LOAD_HEIGHTMAP = 6042,
@@ -867,7 +856,7 @@ namespace OpenRCT2
STR_LANDSCAPE_SAVE_FAILED = 1049,
STR_LOADSAVE_DEFAULT = 5891,
STR_LOADSAVE_DEFAULT_TIP = 5892,
- STR_NAME = 5373,
+ STR_NAME_COLUMN = 5373,
STR_OPENRCT2_HEIGHTMAP_FILE = 6055,
STR_OPENRCT2_LANDSCAPE_FILE = 1045,
STR_OPENRCT2_SAVED_GAME = 1043,
@@ -1069,7 +1058,6 @@ namespace OpenRCT2
STR_OBJECT_ERROR_WINDOW_FILE = 6127,
STR_OBJECT_LOAD_ERROR_TITLE = 6123,
STR_OBJECT_NAME = 6124,
- STR_OBJECT_SELECTION_PARK_ENTRANCE = 3192,
STR_OBJECT_SOURCE = 6131,
STR_OBJECT_TYPE = 6125,
@@ -1115,6 +1103,8 @@ namespace OpenRCT2
STR_DRAWING_ENGINE_TIP = 5876,
STR_EARLY_COMPLETION_TIP = 6227,
STR_EDIT_ASSET_PACKS_BUTTON = 6640,
+ STR_EXPORT_EMSCRIPTEN = 6730,
+ STR_IMPORT_EMSCRIPTEN = 6731,
STR_EDIT_THEMES_BUTTON = 5153,
STR_EDIT_THEMES_BUTTON_TIP = 5837,
STR_EFFECTS_GROUP = 6256,
@@ -1202,6 +1192,7 @@ namespace OpenRCT2
STR_RIDE_MUSIC = 1777,
STR_RIDE_MUSIC_TIP = 5854,
STR_ROLLERCOASTER_TYCOON_1_DROPDOWN = 2740,
+ STR_ROTATE_VIEW_ANTI_CLOCKWISE_IN_TOOLBAR_TIP = 6732,
STR_SAVE_EVERY_15MINUTES = 2703,
STR_SAVE_EVERY_30MINUTES = 2704,
STR_SAVE_EVERY_5MINUTES = 2702,
@@ -2114,6 +2105,8 @@ namespace OpenRCT2
STR_TILE_INSPECTOR_WALL_SLOPED_LEFT = 5977,
STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT = 5978,
STR_TILE_INSPECTOR_WALL_TYPE = 5979,
+ STR_TILE_INSPECTOR_X_LABEL = 6725,
+ STR_TILE_INSPECTOR_Y_LABEL = 6726,
// Window: TitleExit
STR_EXIT = 1924,
@@ -2282,4 +2275,4 @@ namespace OpenRCT2
STR_ADJUST_SMALLER_WATER_TIP = 2380,
STR_WATER = 2383,
};
-}
+} // namespace OpenRCT2
diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp
index 2cc12717f2..25592639ad 100644
--- a/src/openrct2-ui/WindowManager.cpp
+++ b/src/openrct2-ui/WindowManager.cpp
@@ -10,16 +10,20 @@
#include "WindowManager.h"
#include "interface/Theme.h"
+#include "interface/Window.h"
#include "ride/VehicleSounds.h"
-#include "windows/Window.h"
+#include "windows/Windows.h"
#include
#include
#include
#include
#include
-#include
+#include
+#include
+#include
#include
+#include
#include
#include
#include
@@ -30,12 +34,19 @@
#include
#include
#include
+#include
#include
using namespace OpenRCT2;
using namespace OpenRCT2::Ui;
using namespace OpenRCT2::Ui::Windows;
+namespace WindowCloseFlags
+{
+ static constexpr uint32_t None = 0;
+ static constexpr uint32_t CloseSingle = (1 << 0);
+} // namespace WindowCloseFlags
+
class WindowManager final : public IWindowManager
{
public:
@@ -323,7 +334,7 @@ public:
case INTENT_ACTION_NEW_SCENERY:
{
// Check if window is already open
- auto* window = WindowBringToFrontByClass(WindowClass::Scenery);
+ auto* window = BringToFrontByClass(WindowClass::Scenery);
if (window == nullptr)
ToggleSceneryWindow();
@@ -403,7 +414,7 @@ public:
case INTENT_ACTION_REFRESH_RIDE_LIST:
{
- auto window = WindowFindByClass(WindowClass::RideList);
+ auto window = FindByClass(WindowClass::RideList);
if (window != nullptr)
{
WindowRideListRefreshList(window);
@@ -419,10 +430,10 @@ public:
case INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS:
{
auto rideIndex = intent.GetUIntExtra(INTENT_EXTRA_RIDE_ID);
- auto w = WindowFindByClass(WindowClass::RideConstruction);
- if (w == nullptr || w->number != rideIndex)
+ auto w = FindByClass(WindowClass::RideConstruction);
+ if (w == nullptr || w->number != static_cast(rideIndex))
{
- WindowCloseConstructionWindows();
+ CloseConstructionWindows();
_currentRideIndex = RideId::FromUnderlying(rideIndex);
OpenWindow(WindowClass::RideConstruction);
}
@@ -491,19 +502,19 @@ public:
case INTENT_ACTION_UPDATE_CLIMATE:
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
- WindowInvalidateByClass(WindowClass::GuestList);
+ InvalidateByClass(WindowClass::GuestList);
break;
case INTENT_ACTION_UPDATE_GUEST_COUNT:
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
- WindowInvalidateByClass(WindowClass::GuestList);
- WindowInvalidateByClass(WindowClass::ParkInformation);
+ InvalidateByClass(WindowClass::GuestList);
+ InvalidateByClass(WindowClass::ParkInformation);
WindowGuestListRefreshList();
break;
case INTENT_ACTION_UPDATE_PARK_RATING:
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING;
- WindowInvalidateByClass(WindowClass::ParkInformation);
+ InvalidateByClass(WindowClass::ParkInformation);
break;
case INTENT_ACTION_UPDATE_DATE:
@@ -511,7 +522,7 @@ public:
break;
case INTENT_ACTION_UPDATE_CASH:
- WindowInvalidateByClass(WindowClass::Finances);
+ InvalidateByClass(WindowClass::Finances);
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
break;
@@ -519,7 +530,7 @@ public:
{
rct_windownumber bannerIndex = static_cast(intent.GetUIntExtra(INTENT_EXTRA_BANNER_INDEX));
- WindowBase* w = WindowFindByNumber(WindowClass::Banner, bannerIndex);
+ WindowBase* w = FindByNumber(WindowClass::Banner, bannerIndex);
if (w != nullptr)
{
w->Invalidate();
@@ -527,8 +538,8 @@ public:
break;
}
case INTENT_ACTION_UPDATE_RESEARCH:
- WindowInvalidateByClass(WindowClass::Finances);
- WindowInvalidateByClass(WindowClass::Research);
+ InvalidateByClass(WindowClass::Finances);
+ InvalidateByClass(WindowClass::Research);
break;
case INTENT_ACTION_UPDATE_VEHICLE_SOUNDS:
@@ -547,7 +558,7 @@ public:
case INTENT_ACTION_TILE_MODIFY:
{
- WindowInvalidateByClass(WindowClass::TileInspector);
+ InvalidateByClass(WindowClass::TileInspector);
break;
}
@@ -646,6 +657,714 @@ public:
}
return nullptr;
}
+
+ static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
+ {
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (w->flags & WF_STICK_TO_BACK)
+ continue;
+
+ if (loc.x + width <= w->windowPos.x)
+ continue;
+ if (loc.x >= w->windowPos.x + w->width)
+ continue;
+ if (loc.y + height <= w->windowPos.y)
+ continue;
+ if (loc.y >= w->windowPos.y + w->height)
+ continue;
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
+ {
+ if (loc.x < 0)
+ return false;
+ if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
+ return false;
+ if (loc.x + width > ContextGetWidth())
+ return false;
+ if (loc.y + height > ContextGetHeight())
+ return false;
+ return WindowFitsBetweenOthers(loc, width, height);
+ }
+
+ static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
+ {
+ uint16_t screenWidth = ContextGetWidth();
+ uint16_t screenHeight = ContextGetHeight();
+ int32_t unk;
+
+ unk = -(width / 4);
+ if (loc.x < unk)
+ return false;
+ unk = screenWidth + (unk * 2);
+ if (loc.x > unk)
+ return false;
+ if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
+ return false;
+ unk = screenHeight - (height / 4);
+ if (loc.y > unk)
+ return false;
+ return WindowFitsBetweenOthers(loc, width, height);
+ }
+
+ static ScreenCoordsXY ClampWindowToScreen(
+ const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width,
+ const int32_t height)
+ {
+ auto screenPos = pos;
+ if (width > screenWidth || screenPos.x < 0)
+ screenPos.x = 0;
+ else if (screenPos.x + width > screenWidth)
+ screenPos.x = screenWidth - width;
+
+ auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1);
+ if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
+ screenPos.y = toolbarAllowance;
+ else if (screenPos.y + height - toolbarAllowance > screenHeight)
+ screenPos.y = screenHeight + toolbarAllowance - height;
+
+ return screenPos;
+ }
+
+ static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
+ {
+ auto uiContext = GetContext()->GetUiContext();
+ auto screenWidth = uiContext->GetWidth();
+ auto screenHeight = uiContext->GetHeight();
+
+ // Place window in an empty corner of the screen
+ const ScreenCoordsXY cornerPositions[] = {
+ { 0, 30 }, // topLeft
+ { screenWidth - width, 30 }, // topRight
+ { 0, screenHeight - 34 - height }, // bottomLeft
+ { screenWidth - width, screenHeight - 34 - height }, // bottomRight
+ };
+
+ for (const auto& cornerPos : cornerPositions)
+ {
+ if (WindowFitsWithinSpace(cornerPos, width, height))
+ {
+ return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
+ }
+ }
+
+ // Place window next to another
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (w->flags & WF_STICK_TO_BACK)
+ continue;
+
+ const ScreenCoordsXY offsets[] = {
+ { w->width + 2, 0 },
+ { -w->width - 2, 0 },
+ { 0, w->height + 2 },
+ { 0, -w->height - 2 },
+ { w->width + 2, -w->height - 2 },
+ { -w->width - 2, -w->height - 2 },
+ { w->width + 2, w->height + 2 },
+ { -w->width - 2, w->height + 2 },
+ };
+
+ for (const auto& offset : offsets)
+ {
+ auto screenPos = w->windowPos + offset;
+ if (WindowFitsWithinSpace(screenPos, width, height))
+ {
+ return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
+ }
+ }
+ }
+
+ // Overlap
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (w->flags & WF_STICK_TO_BACK)
+ continue;
+
+ const ScreenCoordsXY offsets[] = {
+ { w->width + 2, 0 },
+ { -w->width - 2, 0 },
+ { 0, w->height + 2 },
+ { 0, -w->height - 2 },
+ };
+
+ for (const auto& offset : offsets)
+ {
+ auto screenPos = w->windowPos + offset;
+ if (WindowFitsOnScreen(screenPos, width, height))
+ {
+ return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
+ }
+ }
+ }
+
+ // Cascade
+ auto screenPos = ScreenCoordsXY{ 0, 30 };
+ for (auto& w : g_window_list)
+ {
+ if (screenPos == w->windowPos)
+ {
+ screenPos.x += 5;
+ screenPos.y += 5;
+ }
+ }
+
+ return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
+ }
+
+ 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(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
+ }
+
+ WindowBase* Create(
+ std::unique_ptr&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
+ uint32_t flags) override
+ {
+ if (flags & WF_AUTO_POSITION)
+ {
+ if (flags & WF_CENTRE_SCREEN)
+ {
+ pos = GetCentrePositionForNewWindow(width, height);
+ }
+ else
+ {
+ pos = GetAutoPositionForNewWindow(width, height);
+ }
+ }
+
+ // Check if there are any window slots left
+ // include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
+ if (g_window_list.size() >= static_cast(Config::Get().general.WindowLimit + kWindowLimitReserved))
+ {
+ // Close least recently used window
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
+ {
+ Close(*w.get());
+ break;
+ }
+ }
+ }
+
+ // Find right position to insert new window
+ auto itDestPos = g_window_list.end();
+ if (flags & WF_STICK_TO_BACK)
+ {
+ for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
+ {
+ if ((*it)->flags & WF_DEAD)
+ continue;
+ if (!((*it)->flags & WF_STICK_TO_BACK))
+ {
+ itDestPos = it;
+ }
+ }
+ }
+ else if (!(flags & WF_STICK_TO_FRONT))
+ {
+ for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
+ {
+ if ((*it)->flags & WF_DEAD)
+ continue;
+ if (!((*it)->flags & WF_STICK_TO_FRONT))
+ {
+ itDestPos = it.base();
+ break;
+ }
+ }
+ }
+
+ auto itNew = g_window_list.insert(itDestPos, std::move(wp));
+ auto w = itNew->get();
+
+ // Setup window
+ w->classification = cls;
+ w->flags = flags;
+
+ // Play sounds and flash the window
+ if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
+ {
+ w->flags |= WF_WHITE_BORDER_MASK;
+ OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
+ }
+
+ w->windowPos = pos;
+ w->width = width;
+ w->height = height;
+ w->min_width = width;
+ w->max_width = width;
+ w->min_height = height;
+ w->max_height = height;
+
+ w->focus = std::nullopt;
+
+ ColourSchemeUpdate(w);
+ w->Invalidate();
+ w->OnOpen();
+ return w;
+ }
+
+ /**
+ * Closes the specified window.
+ * rct2: 0x006ECD4C
+ */
+ void Close(WindowBase& w) override
+ {
+ w.OnClose();
+
+ // Remove viewport
+ w.RemoveViewport();
+
+ // Invalidate the window (area)
+ w.Invalidate();
+
+ w.flags |= WF_DEAD;
+ }
+
+ void CloseSurplus(int32_t cap, WindowClass avoid_classification) override
+ {
+ // find the amount of windows that are currently open
+ auto count = static_cast(g_window_list.size());
+ // difference between amount open and cap = amount to close
+ auto diff = count - kWindowLimitReserved - cap;
+ for (auto i = 0; i < diff; i++)
+ {
+ // iterates through the list until it finds the newest window, or a window that can be closed
+ WindowBase* foundW{};
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
+ {
+ foundW = w.get();
+ break;
+ }
+ }
+ // skip window if window matches specified WindowClass (as user may be modifying via options)
+ if (avoid_classification != WindowClass::Null && foundW != nullptr
+ && foundW->classification == avoid_classification)
+ {
+ continue;
+ }
+ Close(*foundW);
+ }
+ }
+
+ template
+ void CloseByCondition(TPred pred, uint32_t flags = WindowCloseFlags::None)
+ {
+ for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); ++it)
+ {
+ auto& wnd = *(*it);
+ if (wnd.flags & WF_DEAD)
+ continue;
+
+ if (pred(&wnd))
+ {
+ Close(wnd);
+ if (flags & WindowCloseFlags::CloseSingle)
+ {
+ return;
+ }
+ }
+ }
+ }
+
+ /**
+ * Closes all windows with the specified window class.
+ * rct2: 0x006ECCF4
+ */
+ void CloseByClass(WindowClass cls) override
+ {
+ CloseByCondition([&](WindowBase* w) -> bool { return w->classification == cls; });
+ }
+
+ /**
+ * Closes all windows with specified window class and number.
+ * rct2: 0x006ECCF4
+ */
+ void CloseByNumber(WindowClass cls, rct_windownumber number) override
+ {
+ CloseByCondition([cls, number](WindowBase* w) -> bool { return w->classification == cls && w->number == number; });
+ }
+
+ // TODO: Refactor this to use variant once the new window class is done.
+ void CloseByNumber(WindowClass cls, EntityId number) override
+ {
+ CloseByNumber(cls, static_cast(number.ToUnderlying()));
+ }
+
+ /**
+ * Closes the top-most window
+ *
+ * rct2: 0x006E403C
+ */
+ void CloseTop() override
+ {
+ CloseByClass(WindowClass::Dropdown);
+
+ if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
+ {
+ if (GetGameState().EditorStep != EditorStep::LandscapeEditor)
+ return;
+ }
+
+ auto pred = [](WindowBase* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); };
+ CloseByCondition(pred, WindowCloseFlags::CloseSingle);
+ }
+
+ /**
+ * Closes all open windows
+ *
+ * rct2: 0x006EE927
+ */
+ void CloseAll() override
+ {
+ CloseByClass(WindowClass::Dropdown);
+ CloseByCondition([](WindowBase* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); });
+ }
+
+ void CloseAllExceptClass(WindowClass cls) override
+ {
+ CloseByClass(WindowClass::Dropdown);
+ CloseByCondition([cls](WindowBase* w) -> bool {
+ return w->classification != cls && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT));
+ });
+ }
+
+ /**
+ * Closes all windows, save for those having any of the passed flags.
+ */
+ void CloseAllExceptFlags(uint16_t flags) override
+ {
+ CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags & flags); });
+ }
+
+ /**
+ * Closes all windows except the specified window number and class.
+ */
+ void CloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls) override
+ {
+ CloseByClass(WindowClass::Dropdown);
+ CloseByCondition([cls, number](WindowBase* w) -> bool {
+ return (!(w->number == number && w->classification == cls) && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)));
+ });
+ }
+
+ /**
+ *
+ * rct2: 0x006CBCC3
+ */
+ void CloseConstructionWindows() override
+ {
+ CloseByClass(WindowClass::RideConstruction);
+ CloseByClass(WindowClass::Footpath);
+ CloseByClass(WindowClass::TrackDesignList);
+ CloseByClass(WindowClass::TrackDesignPlace);
+ }
+
+ /**
+ * Finds the first window with the specified window class.
+ * rct2: 0x006EA8A0
+ * @returns the window or nullptr if no window was found.
+ */
+ WindowBase* FindByClass(WindowClass cls) override
+ {
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (w->classification == cls)
+ {
+ return w.get();
+ }
+ }
+ return nullptr;
+ }
+
+ /**
+ * Finds the first window with the specified window class and number.
+ * rct2: 0x006EA8A0
+ * @returns the window or nullptr if no window was found.
+ */
+ WindowBase* FindByNumber(WindowClass cls, rct_windownumber number) override
+ {
+ for (auto& w : g_window_list)
+ {
+ if (w->flags & WF_DEAD)
+ continue;
+ if (w->classification == cls && w->number == number)
+ {
+ return w.get();
+ }
+ }
+ return nullptr;
+ }
+
+ // TODO: Use variant for this once the window framework is done.
+ WindowBase* FindByNumber(WindowClass cls, EntityId id) override
+ {
+ return FindByNumber(cls, static_cast(id.ToUnderlying()));
+ }
+
+ /**
+ *
+ * rct2: 0x006EA845
+ */
+ WindowBase* FindFromPoint(const ScreenCoordsXY& screenCoords) override
+ {
+ for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
+ {
+ auto& w = *it;
+ if (w->flags & WF_DEAD)
+ continue;
+
+ if (screenCoords.x < w->windowPos.x || screenCoords.x >= w->windowPos.x + w->width
+ || screenCoords.y < w->windowPos.y || screenCoords.y >= w->windowPos.y + w->height)
+ continue;
+
+ if (w->flags & WF_NO_BACKGROUND)
+ {
+ auto widgetIndex = FindWidgetFromPoint(*w.get(), screenCoords);
+ if (widgetIndex == kWidgetIndexNull)
+ continue;
+ }
+
+ return w.get();
+ }
+
+ return nullptr;
+ }
+
+ /**
+ *
+ * rct2: 0x006EA594
+ * returns widget_index if found, -1 otherwise
+ */
+ WidgetIndex FindWidgetFromPoint(WindowBase& w, const ScreenCoordsXY& screenCoords) override
+ {
+ // Invalidate the window
+ w.OnPrepareDraw();
+
+ // Find the widget at point x, y
+ WidgetIndex widget_index = kWidgetIndexNull;
+ for (auto i = 0u; i < w.widgets.size(); i++)
+ {
+ const auto& widget = w.widgets[i];
+
+ if (widget.type != WindowWidgetType::Empty && widget.IsVisible())
+ {
+ if (screenCoords.x >= w.windowPos.x + widget.left && screenCoords.x <= w.windowPos.x + widget.right
+ && screenCoords.y >= w.windowPos.y + widget.top && screenCoords.y <= w.windowPos.y + widget.bottom)
+ {
+ widget_index = i;
+ }
+ }
+ }
+
+ // Return next widget if a dropdown
+ if (widget_index != kWidgetIndexNull)
+ {
+ const auto& widget = w.widgets[widget_index];
+ if (widget.type == WindowWidgetType::DropdownMenu)
+ widget_index++;
+ }
+
+ // Return the widget index
+ return widget_index;
+ }
+
+ /**
+ * Invalidates the specified window.
+ * rct2: 0x006EB13A
+ */
+ template
+ static void InvalidateByCondition(TPred pred)
+ {
+ WindowVisitEach([pred](WindowBase* w) {
+ if (pred(w))
+ {
+ w->Invalidate();
+ }
+ });
+ }
+
+ /**
+ * Invalidates all windows with the specified window class.
+ * rct2: 0x006EC3AC
+ */
+ void InvalidateByClass(WindowClass cls) override
+ {
+ InvalidateByCondition([cls](WindowBase* w) -> bool { return w->classification == cls; });
+ }
+
+ /**
+ * Invalidates all windows with the specified window class and number.
+ * rct2: 0x006EC3AC
+ */
+ void InvalidateByNumber(WindowClass cls, rct_windownumber number) override
+ {
+ InvalidateByCondition([cls, number](WindowBase* w) -> bool { return w->classification == cls && w->number == number; });
+ }
+
+ // TODO: Use variant for this once the window framework is done.
+ void InvalidateByNumber(WindowClass cls, EntityId id) override
+ {
+ InvalidateByNumber(cls, static_cast(id.ToUnderlying()));
+ }
+
+ /**
+ * Invalidates all windows.
+ */
+ void InvalidateAll() override
+ {
+ WindowVisitEach([](WindowBase* w) { w->Invalidate(); });
+ }
+
+ /**
+ * Invalidates the specified widget of a window.
+ * rct2: 0x006EC402
+ */
+ void InvalidateWidget(WindowBase& w, WidgetIndex widgetIndex) override
+ {
+ if (w.widgets.empty())
+ {
+ // This might be called before the window is fully created.
+ return;
+ }
+
+ if (static_cast(widgetIndex) >= w.widgets.size())
+ {
+ return;
+ }
+
+ const auto& widget = w.widgets[widgetIndex];
+ if (widget.left == -2)
+ return;
+
+ GfxSetDirtyBlocks({ { w.windowPos + ScreenCoordsXY{ widget.left, widget.top } },
+ { w.windowPos + ScreenCoordsXY{ widget.right + 1, widget.bottom + 1 } } });
+ }
+
+ /**
+ * Invalidates the specified widget of all windows that match the specified window class.
+ */
+ void InvalidateWidgetByClass(WindowClass cls, WidgetIndex widgetIndex) override
+ {
+ WindowVisitEach([this, cls, widgetIndex](WindowBase* w) {
+ if (w->classification == cls)
+ {
+ InvalidateWidget(*w, widgetIndex);
+ }
+ });
+ }
+
+ /**
+ * Invalidates the specified widget of all windows that match the specified window class and number.
+ * rct2: 0x006EC3AC
+ */
+ void InvalidateWidgetByNumber(WindowClass cls, rct_windownumber number, WidgetIndex widgetIndex) override
+ {
+ WindowVisitEach([this, cls, number, widgetIndex](WindowBase* w) {
+ if (w->classification == cls && w->number == number)
+ {
+ InvalidateWidget(*w, widgetIndex);
+ }
+ });
+ }
+
+ /**
+ *
+ * rct2: 0x006ECDA4
+ */
+ WindowBase* BringToFront(WindowBase& w) override
+ {
+ if (!(w.flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
+ {
+ auto itSourcePos = WindowGetIterator(&w);
+ if (itSourcePos != g_window_list.end())
+ {
+ // Insert in front of the first non-stick-to-front window
+ auto itDestPos = g_window_list.begin();
+ for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
+ {
+ auto& w2 = *it;
+ if (!(w2->flags & WF_STICK_TO_FRONT))
+ {
+ itDestPos = it.base();
+ break;
+ }
+ }
+
+ g_window_list.splice(itDestPos, g_window_list, itSourcePos);
+ w.Invalidate();
+
+ if (w.windowPos.x + w.width < 20)
+ {
+ int32_t i = 20 - w.windowPos.x;
+ w.windowPos.x += i;
+ if (w.viewport != nullptr)
+ w.viewport->pos.x += i;
+ w.Invalidate();
+ }
+ }
+ }
+ return &w;
+ }
+
+ WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override
+ {
+ WindowBase* w = FindByClass(cls);
+ if (w != nullptr)
+ {
+ w->flags |= flags;
+ w->Invalidate();
+ w = BringToFront(*w);
+ }
+
+ return w;
+ }
+
+ WindowBase* BringToFrontByClass(WindowClass cls) override
+ {
+ return BringToFrontByClassWithFlags(cls, WF_WHITE_BORDER_MASK);
+ }
+
+ /**
+ *
+ * rct2: 0x006ED78A
+ */
+ WindowBase* BringToFrontByNumber(WindowClass cls, rct_windownumber number) override
+ {
+ WindowBase* w = FindByNumber(cls, number);
+ if (w != nullptr)
+ {
+ w->flags |= WF_WHITE_BORDER_MASK;
+ w->Invalidate();
+ w = BringToFront(*w);
+ }
+
+ return w;
+ }
};
std::unique_ptr OpenRCT2::Ui::CreateWindowManager()
diff --git a/src/openrct2-ui/audio/AudioContext.cpp b/src/openrct2-ui/audio/AudioContext.cpp
index 17ad6e709f..e20ffc5f8a 100644
--- a/src/openrct2-ui/audio/AudioContext.cpp
+++ b/src/openrct2-ui/audio/AudioContext.cpp
@@ -25,7 +25,7 @@ namespace OpenRCT2::Audio
class AudioContext final : public IAudioContext
{
private:
- static constexpr size_t STREAM_MIN_SIZE = 2 * 1024 * 1024; // 2 MiB
+ static constexpr size_t kStreamMinSize = 2 * 1024 * 1024; // 2 MiB
std::unique_ptr _audioMixer;
@@ -110,7 +110,7 @@ namespace OpenRCT2::Audio
// Load whole stream into memory if small enough
auto dataLength = source->GetLength();
- if (dataLength < STREAM_MIN_SIZE)
+ if (dataLength < kStreamMinSize)
{
auto& targetFormat = _audioMixer->GetFormat();
source = source->ToMemory(targetFormat);
diff --git a/src/openrct2-ui/audio/SDLAudioSource.cpp b/src/openrct2-ui/audio/SDLAudioSource.cpp
index 340566d9a5..ca267a3b8d 100644
--- a/src/openrct2-ui/audio/SDLAudioSource.cpp
+++ b/src/openrct2-ui/audio/SDLAudioSource.cpp
@@ -80,20 +80,20 @@ std::unique_ptr SDLAudioSource::ToMemory(const AudioFormat& targ
static AudioCodecKind GetAudioCodec(SDL_RWops* rw)
{
- constexpr uint32_t MAGIC_FLAC = 0x43614C66;
- constexpr uint32_t MAGIC_OGG = 0x5367674F;
- constexpr uint32_t MAGIC_RIFF = 0x46464952;
+ constexpr uint32_t kMagicFLAC = 0x43614C66;
+ constexpr uint32_t kMagicOGG = 0x5367674F;
+ constexpr uint32_t kMagicRIFF = 0x46464952;
auto originalPosition = SDL_RWtell(rw);
auto magic = SDL_ReadLE32(rw);
SDL_RWseek(rw, originalPosition, RW_SEEK_SET);
switch (magic)
{
- case MAGIC_FLAC:
+ case kMagicFLAC:
return AudioCodecKind::Flac;
- case MAGIC_OGG:
+ case kMagicOGG:
return AudioCodecKind::Ogg;
- case MAGIC_RIFF:
+ case kMagicRIFF:
return AudioCodecKind::Wav;
default:
return AudioCodecKind::Unknown;
diff --git a/src/openrct2-ui/audio/WavAudioSource.cpp b/src/openrct2-ui/audio/WavAudioSource.cpp
index a3ada6322f..5b6e12ff8b 100644
--- a/src/openrct2-ui/audio/WavAudioSource.cpp
+++ b/src/openrct2-ui/audio/WavAudioSource.cpp
@@ -20,11 +20,11 @@ namespace OpenRCT2::Audio
class WavAudioSource final : public SDLAudioSource
{
private:
- static constexpr uint32_t DATA = 0x61746164;
- static constexpr uint32_t FMT = 0x20746D66;
- static constexpr uint32_t RIFF = 0x46464952;
- static constexpr uint32_t WAVE = 0x45564157;
- static constexpr uint16_t pcmformat = 0x0001;
+ static constexpr uint32_t kChunkIdDATA = 0x61746164;
+ static constexpr uint32_t kChunkIdFMT = 0x20746D66;
+ static constexpr uint32_t kChunkIdRIFF = 0x46464952;
+ static constexpr uint32_t kChunkIdWAVE = 0x45564157;
+ static constexpr uint16_t kPCMFormat = 0x0001;
SDL_RWops* _rw{};
AudioFormat _format = {};
@@ -36,7 +36,7 @@ namespace OpenRCT2::Audio
: _rw(rw)
{
auto chunkId = SDL_ReadLE32(rw);
- if (chunkId != RIFF)
+ if (chunkId != kChunkIdRIFF)
{
SDL_RWclose(rw);
throw std::runtime_error("Not a WAV file");
@@ -45,13 +45,13 @@ namespace OpenRCT2::Audio
// Read and discard chunk size
SDL_ReadLE32(rw);
auto chunkFormat = SDL_ReadLE32(rw);
- if (chunkFormat != WAVE)
+ if (chunkFormat != kChunkIdWAVE)
{
SDL_RWclose(rw);
throw std::runtime_error("Not in WAVE format");
}
- auto fmtChunkSize = FindChunk(rw, FMT);
+ auto fmtChunkSize = FindChunk(rw, kChunkIdFMT);
if (!fmtChunkSize)
{
SDL_RWclose(rw);
@@ -61,7 +61,7 @@ namespace OpenRCT2::Audio
auto chunkStart = SDL_RWtell(rw);
auto encoding = SDL_ReadLE16(rw);
- if (encoding != pcmformat)
+ if (encoding != kPCMFormat)
{
SDL_RWclose(rw);
throw std::runtime_error("Not in PCM format");
@@ -87,7 +87,7 @@ namespace OpenRCT2::Audio
SDL_RWseek(rw, chunkStart + fmtChunkSize, RW_SEEK_SET);
- auto dataChunkSize = FindChunk(rw, DATA);
+ auto dataChunkSize = FindChunk(rw, kChunkIdDATA);
if (dataChunkSize == 0)
{
SDL_RWclose(rw);
@@ -155,11 +155,12 @@ namespace OpenRCT2::Audio
{
return subchunkSize;
}
- constexpr uint32_t FACT = 0x74636166;
- constexpr uint32_t LIST = 0x5453494c;
- constexpr uint32_t BEXT = 0x74786562;
- constexpr uint32_t JUNK = 0x4B4E554A;
- while (subchunkId == FACT || subchunkId == LIST || subchunkId == BEXT || subchunkId == JUNK)
+ constexpr uint32_t kChunkIdFACT = 0x74636166;
+ constexpr uint32_t kChunkIdLIST = 0x5453494c;
+ constexpr uint32_t kChunkIdBEXT = 0x74786562;
+ constexpr uint32_t kChunkIdJUNK = 0x4B4E554A;
+ while (subchunkId == kChunkIdFACT || subchunkId == kChunkIdLIST || subchunkId == kChunkIdBEXT
+ || subchunkId == kChunkIdJUNK)
{
SDL_RWseek(rw, subchunkSize, RW_SEEK_CUR);
subchunkId = SDL_ReadLE32(rw);
diff --git a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp
index 6b0d7f4d8d..d5ba5cfb5b 100644
--- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp
+++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp
@@ -30,7 +30,7 @@ using namespace OpenRCT2::Ui;
class HardwareDisplayDrawingEngine final : public X8DrawingEngine
{
private:
- constexpr static uint32_t DIRTY_VISUAL_TIME = 32;
+ constexpr static uint32_t kDirtyVisualTime = 32;
std::shared_ptr const _uiContext;
SDL_Window* _window = nullptr;
@@ -223,7 +223,7 @@ protected:
{
for (uint32_t y = top; y < bottom; y++)
{
- SetDirtyVisualTime(x, y, DIRTY_VISUAL_TIME);
+ SetDirtyVisualTime(x, y, kDirtyVisualTime);
}
}
}
diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp
index 4663357757..16d2758d56 100644
--- a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp
@@ -22,7 +22,7 @@ namespace
};
} // namespace
-constexpr VDStruct VertexData[4] = {
+constexpr VDStruct kVertexData[4] = {
{ -1.0f, -1.0f, 0.0f, 0.0f },
{ 1.0f, -1.0f, 1.0f, 0.0f },
{ -1.0f, 1.0f, 0.0f, 1.0f },
@@ -38,7 +38,7 @@ ApplyPaletteShader::ApplyPaletteShader()
glGenVertexArrays(1, &_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
- glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
glBindVertexArray(_vao);
glVertexAttribPointer(
diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp
index 14b9032439..3d4201ecee 100644
--- a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp
@@ -22,7 +22,7 @@ namespace
};
} // namespace
-constexpr VDStruct VertexData[4] = {
+constexpr VDStruct kVertexData[4] = {
{ -1.0f, -1.0f, 0.0f, 0.0f },
{ 1.0f, -1.0f, 1.0f, 0.0f },
{ -1.0f, 1.0f, 0.0f, 1.0f },
@@ -38,7 +38,7 @@ ApplyTransparencyShader::ApplyTransparencyShader()
glGenVertexArrays(1, &_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
- glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
glBindVertexArray(_vao);
glVertexAttribPointer(
diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp
index 07f2aa8ba5..b3a47c9f16 100644
--- a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp
@@ -23,7 +23,7 @@ namespace
};
} // namespace
-constexpr VDStruct VertexData[2] = {
+constexpr VDStruct kVertexData[2] = {
{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
};
@@ -38,7 +38,7 @@ DrawLineShader::DrawLineShader()
glGenVertexArrays(1, &_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
- glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
glBindVertexArray(_vao);
glVertexAttribPointer(
diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp
index 4de36de760..331a3004ea 100644
--- a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp
@@ -22,18 +22,18 @@ namespace
};
} // namespace
-constexpr VDStruct VertexData[4] = {
+constexpr VDStruct kVertexData[4] = {
{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f },
{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f },
};
-constexpr size_t InitialInstancesBufferSize = 32768;
+constexpr size_t kInitialInstancesBufferSize = 32768;
DrawRectShader::DrawRectShader()
: OpenGLShaderProgram("drawrect")
- , _maxInstancesBufferSize(InitialInstancesBufferSize)
+ , _maxInstancesBufferSize(kInitialInstancesBufferSize)
{
GetLocations();
@@ -42,7 +42,7 @@ DrawRectShader::DrawRectShader()
glGenVertexArrays(1, &_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
- glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
glBindVertexArray(_vao);
@@ -57,7 +57,7 @@ DrawRectShader::DrawRectShader()
glVertexAttribPointer(vVertVec, 2, GL_FLOAT, GL_FALSE, sizeof(VDStruct), reinterpret_cast(offsetof(VDStruct, vec)));
glBindBuffer(GL_ARRAY_BUFFER, _vboInstances);
- glBufferData(GL_ARRAY_BUFFER, sizeof(DrawRectCommand) * InitialInstancesBufferSize, NULL, GL_STREAM_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(DrawRectCommand) * kInitialInstancesBufferSize, nullptr, GL_STREAM_DRAW);
glVertexAttribIPointer(vClip, 4, GL_INT, sizeof(DrawRectCommand), reinterpret_cast(offsetof(DrawRectCommand, clip)));
glVertexAttribIPointer(
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h
index 424ac1b438..80a228904e 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h
@@ -42,7 +42,11 @@ OPENGL_PROC(PFNGLATTACHSHADERPROC, glAttachShader)
OPENGL_PROC(PFNGLBINDBUFFERPROC, glBindBuffer)
OPENGL_PROC(PFNGLBINDFRAGDATALOCATIONPROC, glBindFragDataLocation)
OPENGL_PROC(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer)
+#ifndef FAKE__EMSCRIPTEN__
OPENGL_PROC(PFNGLBINDVERTEXARRAYPROC, glBindVertexArray)
+#else
+extern "C" void glBindVertexArray(GLuint array);
+#endif
OPENGL_PROC(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer)
OPENGL_PROC(PFNGLBUFFERDATAPROC, glBufferData)
OPENGL_PROC(PFNGLBUFFERSUBDATAPROC, glBufferSubData)
@@ -55,7 +59,11 @@ OPENGL_PROC(PFNGLDELETEBUFFERSPROC, glDeleteBuffers)
OPENGL_PROC(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers)
OPENGL_PROC(PFNGLDELETEPROGRAMPROC, glDeleteProgram)
OPENGL_PROC(PFNGLDELETESHADERPROC, glDeleteShader)
+#ifndef FAKE__EMSCRIPTEN__
OPENGL_PROC(PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays)
+#else
+extern "C" void glDeleteVertexArrays(GLsizei n, const GLuint* arrays);
+#endif
OPENGL_PROC(PFNGLDETACHSHADERPROC, glDetachShader)
OPENGL_PROC(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray)
OPENGL_PROC(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D)
@@ -67,7 +75,11 @@ OPENGL_PROC(PFNGLGETPROGRAMIVPROC, glGetProgramiv)
OPENGL_PROC(PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog)
OPENGL_PROC(PFNGLGETSHADERIVPROC, glGetShaderiv)
OPENGL_PROC(PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation)
+#ifndef FAKE__EMSCRIPTEN__
OPENGL_PROC(PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays)
+#else
+extern "C" void glGenVertexArrays(GLsizei n, GLuint* arrays);
+#endif
OPENGL_PROC(PFNGLLINKPROGRAMPROC, glLinkProgram)
OPENGL_PROC(PFNGLSHADERSOURCEPROC, glShaderSource)
OPENGL_PROC(PFNGLUNIFORM1IPROC, glUniform1i)
@@ -82,6 +94,11 @@ OPENGL_PROC(PFNGLUNIFORM4FVPROC, glUniform4fv)
OPENGL_PROC(PFNGLUSEPROGRAMPROC, glUseProgram)
OPENGL_PROC(PFNGLVERTEXATTRIBIPOINTERPROC, glVertexAttribIPointer)
OPENGL_PROC(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer)
+#ifndef FAKE__EMSCRIPTEN__
OPENGL_PROC(PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced)
OPENGL_PROC(PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttribDivisor)
+#else
+extern "C" void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+extern "C" void glVertexAttribDivisor(GLuint index, GLuint divisor);
+#endif
OPENGL_PROC(PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate)
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp
index 6c46095015..cef31e690a 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp
@@ -47,7 +47,7 @@ struct OpenGLVersion
GLint Minor;
};
-constexpr OpenGLVersion OPENGL_MINIMUM_REQUIRED_VERSION = { 3, 3 };
+constexpr OpenGLVersion kOpenGLMinimumRequiredVersion = { 3, 3 };
constexpr uint8_t kCSInside = 0b0000;
constexpr uint8_t kCSLeft = 0b0001;
@@ -70,7 +70,9 @@ private:
int32_t _drawCount = 0;
+ #ifndef NO_TTF
uint32_t _ttfGlId = 0;
+ #endif
struct
{
@@ -216,7 +218,7 @@ public:
void Initialise() override
{
- OpenGLVersion requiredVersion = OPENGL_MINIMUM_REQUIRED_VERSION;
+ OpenGLVersion requiredVersion = kOpenGLMinimumRequiredVersion;
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, requiredVersion.Major);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, requiredVersion.Minor);
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp
index 445c0613a1..b9f86f0654 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp
@@ -18,11 +18,11 @@
using namespace OpenRCT2::Ui;
-constexpr GLuint BACKBUFFER_ID = 0;
+constexpr GLuint kBackBufferID = 0;
OpenGLFramebuffer::OpenGLFramebuffer(SDL_Window* window)
{
- _id = BACKBUFFER_ID;
+ _id = kBackBufferID;
_texture = 0;
_depth = 0;
SDL_GL_GetDrawableSize(window, &_width, &_height);
@@ -65,7 +65,7 @@ OpenGLFramebuffer::OpenGLFramebuffer(int32_t width, int32_t height, bool depth,
OpenGLFramebuffer::~OpenGLFramebuffer()
{
- if (_id != BACKBUFFER_ID)
+ if (_id != kBackBufferID)
{
glDeleteTextures(1, &_texture);
glDeleteTextures(1, &_depth);
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp
index 74a5db8141..88001df572 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp
@@ -77,7 +77,7 @@ std::string OpenGLShader::ReadSourceCode(const std::string& path)
auto fs = FileStream(path, FILE_MODE_OPEN);
uint64_t fileLength = fs.GetLength();
- if (fileLength > MaxSourceSize)
+ if (fileLength > kMaxSourceSize)
{
throw IOException("Shader source too large.");
}
diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h
index 167bcb75f5..2537e75c88 100644
--- a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h
+++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.h
@@ -18,7 +18,7 @@ namespace OpenRCT2::Ui
class OpenGLShader final
{
private:
- static constexpr uint64_t MaxSourceSize = 8 * 1024 * 1024; // 8 MiB
+ static constexpr uint64_t kMaxSourceSize = 8 * 1024 * 1024; // 8 MiB
GLenum _type;
GLuint _id = 0;
diff --git a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp
index 86ebfbe548..3a85b1a6e8 100644
--- a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp
@@ -15,9 +15,9 @@
using namespace OpenRCT2::Ui;
-constexpr GLfloat depthValue[1] = { 1.0f };
-constexpr GLfloat depthValueTransparent[1] = { 0.0f };
-constexpr GLuint indexValue[4] = { 0, 0, 0, 0 };
+constexpr GLfloat kDepthValue[1] = { 1.0f };
+constexpr GLfloat kDepthValueTransparent[1] = { 0.0f };
+constexpr GLuint kIndexValue[4] = { 0, 0, 0, 0 };
SwapFramebuffer::SwapFramebuffer(int32_t width, int32_t height)
: _opaqueFramebuffer(width, height)
@@ -26,7 +26,7 @@ SwapFramebuffer::SwapFramebuffer(int32_t width, int32_t height)
, _backDepth(OpenGLFramebuffer::CreateDepthTexture(width, height))
{
_transparentFramebuffer.Bind();
- glClearBufferfv(GL_DEPTH, 0, depthValueTransparent);
+ glClearBufferfv(GL_DEPTH, 0, kDepthValueTransparent);
}
SwapFramebuffer::~SwapFramebuffer()
@@ -48,8 +48,8 @@ void SwapFramebuffer::ApplyTransparency(ApplyTransparencyShader& shader, GLuint
// Clear transparency buffers
_transparentFramebuffer.Bind();
- glClearBufferuiv(GL_COLOR, 0, indexValue);
- glClearBufferfv(GL_DEPTH, 0, depthValueTransparent);
+ glClearBufferuiv(GL_COLOR, 0, kIndexValue);
+ glClearBufferfv(GL_DEPTH, 0, kDepthValueTransparent);
_opaqueFramebuffer.SwapColourBuffer(_mixFramebuffer);
// Change binding to guarantee no undefined behavior
@@ -59,7 +59,7 @@ void SwapFramebuffer::ApplyTransparency(ApplyTransparencyShader& shader, GLuint
void SwapFramebuffer::Clear()
{
_opaqueFramebuffer.Bind();
- glClearBufferfv(GL_DEPTH, 0, depthValue);
+ glClearBufferfv(GL_DEPTH, 0, kDepthValue);
}
#endif /* DISABLE_OPENGL */
diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp
index 64a3b55ea7..9d65a71149 100644
--- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp
+++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp
@@ -175,9 +175,9 @@ void TextureCache::CreateTextures()
{
// Determine width and height to use for texture atlases
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_atlasesTextureDimensions);
- if (_atlasesTextureDimensions > TEXTURE_CACHE_MAX_ATLAS_SIZE)
+ if (_atlasesTextureDimensions > kTextureCacheMaxAtlasSize)
{
- _atlasesTextureDimensions = TEXTURE_CACHE_MAX_ATLAS_SIZE;
+ _atlasesTextureDimensions = kTextureCacheMaxAtlasSize;
}
// Determine maximum number of atlases (minimum of size and array limit)
diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h
index 9e3772a1fc..1a1b4561dc 100644
--- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h
+++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h
@@ -54,11 +54,11 @@ namespace OpenRCT2::Ui
// 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;
+ constexpr int32_t kTextureCacheMaxAtlasSize = 2048;
// Pixel dimensions of smallest supported slots in texture atlases
// Must be a power of 2!
- constexpr int32_t TEXTURE_CACHE_SMALLEST_SLOT = 32;
+ constexpr int32_t kTextureCacheSmallestSlot = 32;
struct BasicTextureInfo
{
@@ -155,9 +155,9 @@ namespace OpenRCT2::Ui
{
int32_t actualSize = std::max(actualWidth, actualHeight);
- if (actualSize < TEXTURE_CACHE_SMALLEST_SLOT)
+ if (actualSize < kTextureCacheSmallestSlot)
{
- actualSize = TEXTURE_CACHE_SMALLEST_SLOT;
+ actualSize = kTextureCacheSmallestSlot;
}
return static_cast(ceil(log2f(static_cast(actualSize))));
diff --git a/src/openrct2-ui/input/InputManager.cpp b/src/openrct2-ui/input/InputManager.cpp
index 71ca9a517f..ce73541c38 100644
--- a/src/openrct2-ui/input/InputManager.cpp
+++ b/src/openrct2-ui/input/InputManager.cpp
@@ -16,7 +16,8 @@
#include
#include
#include
-#include
+#include
+#include
#include
#include
#include
@@ -24,6 +25,7 @@
#include
#include
#include
+#include
using namespace OpenRCT2::Ui;
@@ -79,10 +81,10 @@ void InputManager::QueueInputEvent(InputEvent&& e)
void InputManager::CheckJoysticks()
{
- constexpr uint32_t CHECK_INTERVAL_MS = 5000;
+ constexpr uint32_t kCheckInternalMs = 5000;
auto tick = SDL_GetTicks();
- if (tick > _lastJoystickCheck + CHECK_INTERVAL_MS)
+ if (tick > _lastJoystickCheck + kCheckInternalMs)
{
_lastJoystickCheck = tick;
@@ -209,8 +211,10 @@ void InputManager::Process(const InputEvent& e)
if (e.DeviceKind == InputDeviceKind::Keyboard)
{
+ auto* windowMgr = GetWindowManager();
+
// TODO: replace with event
- auto w = WindowFindByClass(WindowClass::Textinput);
+ auto w = windowMgr->FindByClass(WindowClass::Textinput);
if (w != nullptr)
{
if (e.State == InputEventState::Release)
@@ -221,7 +225,7 @@ void InputManager::Process(const InputEvent& e)
}
// TODO: replace with event
- w = WindowFindByClass(WindowClass::LoadsaveOverwritePrompt);
+ w = windowMgr->FindByClass(WindowClass::LoadsaveOverwritePrompt);
if (w != nullptr)
{
if (e.State == InputEventState::Release)
@@ -232,7 +236,7 @@ void InputManager::Process(const InputEvent& e)
}
// TODO: replace with event
- w = WindowFindByClass(WindowClass::Loadsave);
+ w = windowMgr->FindByClass(WindowClass::Loadsave);
if (w != nullptr)
{
if (e.State == InputEventState::Release)
@@ -361,9 +365,9 @@ bool InputManager::GetState(const RegisteredShortcut& shortcut) const
bool InputManager::GetState(const ShortcutInput& shortcut) const
{
- constexpr uint32_t UsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GUI;
- auto modifiers = SDL_GetModState() & UsefulModifiers;
- if ((shortcut.Modifiers & UsefulModifiers) == modifiers)
+ constexpr uint32_t kUsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GUI;
+ auto modifiers = SDL_GetModState() & kUsefulModifiers;
+ if ((shortcut.Modifiers & kUsefulModifiers) == modifiers)
{
switch (shortcut.Kind)
{
@@ -421,7 +425,8 @@ bool InputManager::HasTextInputFocus() const
if (OpenRCT2::Ui::Windows::IsUsingWidgetTextBox() || gChatOpen)
return true;
- auto w = WindowFindByClass(WindowClass::Textinput);
+ auto* windowMgr = GetWindowManager();
+ auto w = windowMgr->FindByClass(WindowClass::Textinput);
if (w != nullptr)
return true;
diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp
index eef5e98202..b25245dc1c 100644
--- a/src/openrct2-ui/input/MouseInput.cpp
+++ b/src/openrct2-ui/input/MouseInput.cpp
@@ -21,7 +21,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -30,1693 +30,1726 @@
#include
#include
#include
-#include
#include
#include
#include
#include
+#include
+#include
#include
#include
#include
#include
-using namespace OpenRCT2;
-using namespace OpenRCT2::Ui;
-using namespace OpenRCT2::Ui::Windows;
-
-struct RCTMouseData
+namespace OpenRCT2
{
- uint32_t x;
- uint32_t y;
- MouseState state;
-};
+ using namespace OpenRCT2::Ui;
+ using namespace OpenRCT2::Ui::Windows;
-static RCTMouseData _mouseInputQueue[64];
-static uint8_t _mouseInputQueueReadIndex = 0;
-static uint8_t _mouseInputQueueWriteIndex = 0;
+ struct RCTMouseData
+ {
+ uint32_t x;
+ uint32_t y;
+ MouseState state;
+ };
-static std::optional _ticksSinceDragStart;
-static WidgetRef _dragWidget;
-static uint8_t _dragScrollIndex;
-static int32_t _originalWindowWidth;
-static int32_t _originalWindowHeight;
+ static RCTMouseData _mouseInputQueue[64];
+ static uint8_t _mouseInputQueueReadIndex = 0;
+ static uint8_t _mouseInputQueueWriteIndex = 0;
-static uint8_t _currentScrollIndex;
-static uint8_t _currentScrollArea;
+ static std::optional _ticksSinceDragStart;
+ static WidgetRef _dragWidget;
+ static uint8_t _dragScrollIndex;
+ static int32_t _originalWindowWidth;
+ static int32_t _originalWindowHeight;
-ScreenCoordsXY gInputDragLast;
+ static uint8_t _currentScrollIndex;
+ static uint8_t _currentScrollArea;
-uint32_t gTooltipCloseTimeout;
-WidgetRef gTooltipWidget;
-ScreenCoordsXY gTooltipCursor;
+ ScreenCoordsXY gInputDragLast;
-static std::optional _clickRepeatTicks;
+ uint32_t gTooltipCloseTimeout;
+ WidgetRef gTooltipWidget;
+ ScreenCoordsXY gTooltipCursor;
-static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords);
-static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex);
-static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, WidgetIndex widgetIndex);
-static void InputWidgetOverFlatbuttonInvalidate();
-void ProcessMouseOver(const ScreenCoordsXY& screenCoords);
-void ProcessMouseTool(const ScreenCoordsXY& screenCoords);
-void InvalidateScroll();
-static RCTMouseData* GetMouseInput();
-void TileElementRightClick(int32_t type, TileElement* tileElement, const ScreenCoordsXY& screenCoords);
-static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState state);
-static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex);
-void InputStateWidgetPressed(
- const ScreenCoordsXY& screenCoords, MouseState state, WidgetIndex widgetIndex, WindowBase* w, Widget* widget);
-void SetCursor(CursorID cursor_id);
-static void InputWindowPositionContinue(
- WindowBase& w, const ScreenCoordsXY& lastScreenCoords, const ScreenCoordsXY& newScreenCoords);
-static void InputWindowPositionEnd(WindowBase& w, const ScreenCoordsXY& screenCoords);
-static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
-static void InputWindowResizeContinue(WindowBase& w, const ScreenCoordsXY& screenCoords);
-static void InputWindowResizeEnd();
-static void InputViewportDragBegin(WindowBase& w);
-static void InputViewportDragContinue();
-static void InputViewportDragEnd();
-static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
-static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
-static void InputScrollEnd();
-static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t x, int32_t scroll_id);
-static void InputScrollPartUpdateHLeft(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
-static void InputScrollPartUpdateHRight(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
-static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t y, int32_t scroll_id);
-static void InputScrollPartUpdateVTop(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
-static void InputScrollPartUpdateVBottom(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
-static void InputUpdateTooltip(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
+ static std::optional _clickRepeatTicks;
+
+ static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords);
+ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex);
+ static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, WidgetIndex widgetIndex);
+ static void InputWidgetOverFlatbuttonInvalidate();
+ void ProcessMouseOver(const ScreenCoordsXY& screenCoords);
+ void ProcessMouseTool(const ScreenCoordsXY& screenCoords);
+ void InvalidateScroll();
+ static RCTMouseData* GetMouseInput();
+ void TileElementRightClick(int32_t type, TileElement* tileElement, const ScreenCoordsXY& screenCoords);
+ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState state);
+ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex);
+ void InputStateWidgetPressed(
+ const ScreenCoordsXY& screenCoords, MouseState state, WidgetIndex widgetIndex, WindowBase* w, Widget* widget);
+ void SetCursor(CursorID cursor_id);
+ static void InputWindowPositionContinue(
+ WindowBase& w, const ScreenCoordsXY& lastScreenCoords, const ScreenCoordsXY& newScreenCoords);
+ static void InputWindowPositionEnd(WindowBase& w, const ScreenCoordsXY& screenCoords);
+ static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
+ static void InputWindowResizeContinue(WindowBase& w, const ScreenCoordsXY& screenCoords);
+ static void InputWindowResizeEnd();
+ static void InputViewportDragBegin(WindowBase& w);
+ static void InputViewportDragContinue();
+ static void InputViewportDragEnd();
+ static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
+ static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
+ static void InputScrollEnd();
+ static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t x, int32_t scroll_id);
+ static void InputScrollPartUpdateHLeft(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
+ static void InputScrollPartUpdateHRight(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
+ static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t y, int32_t scroll_id);
+ static void InputScrollPartUpdateVTop(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
+ static void InputScrollPartUpdateVBottom(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id);
+ static void InputUpdateTooltip(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
#pragma region Mouse input
-/**
- *
- * rct2: 0x006EA627
- */
-void GameHandleInput()
-{
- InvalidateAllWindowsAfterInput();
-
- MouseState state;
- ScreenCoordsXY screenCoords;
- while ((state = GameGetNextInput(screenCoords)) != MouseState::Released)
+ /**
+ *
+ * rct2: 0x006EA627
+ */
+ void GameHandleInput()
{
- GameHandleInputMouse(screenCoords, state);
+ InvalidateAllWindowsAfterInput();
+
+ MouseState state;
+ ScreenCoordsXY screenCoords;
+ while ((state = GameGetNextInput(screenCoords)) != MouseState::Released)
+ {
+ GameHandleInputMouse(screenCoords, state);
+ }
+
+ if (_inputFlags & INPUT_FLAG_5)
+ {
+ GameHandleInputMouse(screenCoords, state);
+ }
+ else
+ {
+ int32_t screenWidth = ContextGetWidth();
+ int32_t screenHeight = ContextGetHeight();
+ screenCoords.x = std::clamp(screenCoords.x, 0, screenWidth - 1);
+ screenCoords.y = std::clamp(screenCoords.y, 0, screenHeight - 1);
+
+ GameHandleInputMouse(screenCoords, state);
+ ProcessMouseOver(screenCoords);
+ ProcessMouseTool(screenCoords);
+ }
}
- if (_inputFlags & INPUT_FLAG_5)
+ /**
+ *
+ * rct2: 0x006E83C7
+ */
+ static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords)
{
- GameHandleInputMouse(screenCoords, state);
- }
- else
- {
- int32_t screenWidth = ContextGetWidth();
- int32_t screenHeight = ContextGetHeight();
- screenCoords.x = std::clamp(screenCoords.x, 0, screenWidth - 1);
- screenCoords.y = std::clamp(screenCoords.y, 0, screenHeight - 1);
+ RCTMouseData* input = GetMouseInput();
+ if (input == nullptr)
+ {
+ const CursorState* cursorState = ContextGetCursorState();
+ screenCoords = cursorState->position;
+ return MouseState::Released;
+ }
- GameHandleInputMouse(screenCoords, state);
- ProcessMouseOver(screenCoords);
- ProcessMouseTool(screenCoords);
- }
-}
-
-/**
- *
- * rct2: 0x006E83C7
- */
-static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords)
-{
- RCTMouseData* input = GetMouseInput();
- if (input == nullptr)
- {
- const CursorState* cursorState = ContextGetCursorState();
- screenCoords = cursorState->position;
- return MouseState::Released;
+ screenCoords.x = input->x;
+ screenCoords.y = input->y;
+ return input->state;
}
- screenCoords.x = input->x;
- screenCoords.y = input->y;
- return input->state;
-}
-
-/**
- *
- * rct2: 0x00407074
- */
-static RCTMouseData* GetMouseInput()
-{
- // Check if that location has been written to yet
- if (_mouseInputQueueReadIndex == _mouseInputQueueWriteIndex)
+ /**
+ *
+ * rct2: 0x00407074
+ */
+ static RCTMouseData* GetMouseInput()
{
- return nullptr;
+ // Check if that location has been written to yet
+ if (_mouseInputQueueReadIndex == _mouseInputQueueWriteIndex)
+ {
+ return nullptr;
+ }
+
+ RCTMouseData* result = &_mouseInputQueue[_mouseInputQueueReadIndex];
+ _mouseInputQueueReadIndex = (_mouseInputQueueReadIndex + 1) % std::size(_mouseInputQueue);
+ return result;
}
- RCTMouseData* result = &_mouseInputQueue[_mouseInputQueueReadIndex];
- _mouseInputQueueReadIndex = (_mouseInputQueueReadIndex + 1) % std::size(_mouseInputQueue);
- return result;
-}
-
-/**
- *
- * rct2: 0x006E957F
- */
-static void InputScrollDragBegin(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex)
-{
- _inputState = InputState::ScrollRight;
- gInputDragLast = screenCoords;
- _dragWidget.window_classification = w->classification;
- _dragWidget.window_number = w->number;
- _dragWidget.widget_index = widgetIndex;
- _ticksSinceDragStart = gCurrentRealTimeTicks;
-
- _dragScrollIndex = WindowGetScrollDataIndex(*w, widgetIndex);
- ContextHideCursor();
-}
-
-/**
- * Based on (heavily changed)
- * rct2: 0x006E9E0E, 0x006E9ED0
- */
-static void InputScrollDragContinue(const ScreenCoordsXY& screenCoords, WindowBase* w)
-{
- WidgetIndex widgetIndex = _dragWidget.widget_index;
- uint8_t scrollIndex = _dragScrollIndex;
-
- const auto& widget = w->widgets[widgetIndex];
- auto& scroll = w->scrolls[scrollIndex];
-
- ScreenCoordsXY differentialCoords = screenCoords - gInputDragLast;
- if (differentialCoords.x == 0 && differentialCoords.y == 0)
- return;
-
- if (scroll.flags & HSCROLLBAR_VISIBLE)
+ /**
+ *
+ * rct2: 0x006E957F
+ */
+ static void InputScrollDragBegin(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex)
{
- int16_t size = widget.width() - 1;
- if (scroll.flags & VSCROLLBAR_VISIBLE)
- size -= 11;
- size = std::max(0, scroll.contentWidth - size);
- scroll.contentOffsetX = std::min(std::max(0, scroll.contentOffsetX + differentialCoords.x), size);
+ _inputState = InputState::ScrollRight;
+ gInputDragLast = screenCoords;
+ _dragWidget.window_classification = w->classification;
+ _dragWidget.window_number = w->number;
+ _dragWidget.widget_index = widgetIndex;
+ _ticksSinceDragStart = gCurrentRealTimeTicks;
+
+ _dragScrollIndex = WindowGetScrollDataIndex(*w, widgetIndex);
+ ContextHideCursor();
}
- if (scroll.flags & VSCROLLBAR_VISIBLE)
+ /**
+ * Based on (heavily changed)
+ * rct2: 0x006E9E0E, 0x006E9ED0
+ */
+ static void InputScrollDragContinue(const ScreenCoordsXY& screenCoords, WindowBase* w)
{
- int16_t size = widget.height() - 1;
+ WidgetIndex widgetIndex = _dragWidget.widget_index;
+ uint8_t scrollIndex = _dragScrollIndex;
+
+ const auto& widget = w->widgets[widgetIndex];
+ auto& scroll = w->scrolls[scrollIndex];
+
+ ScreenCoordsXY differentialCoords = screenCoords - gInputDragLast;
+ if (differentialCoords.x == 0 && differentialCoords.y == 0)
+ return;
+
if (scroll.flags & HSCROLLBAR_VISIBLE)
- size -= 11;
- size = std::max(0, scroll.contentHeight - size);
- scroll.contentOffsetY = std::min(std::max(0, scroll.contentOffsetY + differentialCoords.y), size);
+ {
+ int16_t size = widget.width() - 1;
+ if (scroll.flags & VSCROLLBAR_VISIBLE)
+ size -= 11;
+ size = std::max(0, scroll.contentWidth - size);
+ scroll.contentOffsetX = std::min(std::max(0, scroll.contentOffsetX + differentialCoords.x), size);
+ }
+
+ if (scroll.flags & VSCROLLBAR_VISIBLE)
+ {
+ int16_t size = widget.height() - 1;
+ if (scroll.flags & HSCROLLBAR_VISIBLE)
+ size -= 11;
+ size = std::max(0, scroll.contentHeight - size);
+ scroll.contentOffsetY = std::min(std::max(0, scroll.contentOffsetY + differentialCoords.y), size);
+ }
+
+ WidgetScrollUpdateThumbs(*w, widgetIndex);
+
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateByNumber(w->classification, w->number);
+
+ ScreenCoordsXY fixedCursorPosition = {
+ static_cast(std::ceil(gInputDragLast.x * Config::Get().general.WindowScale)),
+ static_cast(std::ceil(gInputDragLast.y * Config::Get().general.WindowScale))
+ };
+
+ ContextSetCursorPosition(fixedCursorPosition);
}
- WidgetScrollUpdateThumbs(*w, widgetIndex);
- WindowInvalidateByNumber(w->classification, w->number);
-
- ScreenCoordsXY fixedCursorPosition = {
- static_cast(std::ceil(gInputDragLast.x * Config::Get().general.WindowScale)),
- static_cast(std::ceil(gInputDragLast.y * Config::Get().general.WindowScale))
- };
-
- ContextSetCursorPosition(fixedCursorPosition);
-}
-
-/**
- *
- * rct2: 0x006E8ACB
- */
-static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState state)
-{
- WindowBase* w = WindowFindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
- if (w == nullptr)
+ /**
+ *
+ * rct2: 0x006E8ACB
+ */
+ static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState state)
{
- ContextShowCursor();
- _inputState = InputState::Reset;
- return;
- }
-
- switch (state)
- {
- case MouseState::Released:
- if (screenCoords.x != 0 || screenCoords.y != 0)
- {
- _ticksSinceDragStart = std::nullopt;
- InputScrollDragContinue(screenCoords, w);
- }
- break;
- case MouseState::RightRelease:
- _inputState = InputState::Reset;
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
+ if (w == nullptr)
+ {
ContextShowCursor();
- break;
- case MouseState::LeftPress:
- case MouseState::LeftRelease:
- case MouseState::RightPress:
- // Function only handles right button, so it's the only one relevant
- break;
- }
-}
+ _inputState = InputState::Reset;
+ return;
+ }
-/**
- *
- * rct2: 0x006E8655
- */
-static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState state)
-{
- WindowBase* w;
- Widget* widget;
- WidgetIndex widgetIndex;
-
- // Get window and widget under cursor position
- w = WindowFindFromPoint(screenCoords);
- widgetIndex = w == nullptr ? -1 : WindowFindWidgetFromPoint(*w, screenCoords);
- widget = widgetIndex == -1 ? nullptr : &w->widgets[widgetIndex];
-
- switch (_inputState)
- {
- case InputState::Reset:
- WindowTooltipReset(screenCoords);
- // fall-through
- case InputState::Normal:
- switch (state)
- {
- case MouseState::Released:
- InputWidgetOver(screenCoords, w, widgetIndex);
- break;
- case MouseState::LeftPress:
- InputWidgetLeft(screenCoords, w, widgetIndex);
- break;
- case MouseState::RightPress:
- WindowCloseByClass(WindowClass::Tooltip);
-
- if (w != nullptr)
- {
- w = WindowBringToFront(*w);
- }
-
- if (widgetIndex != -1)
- {
- switch (widget->type)
- {
- case WindowWidgetType::Viewport:
- if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
- {
- InputViewportDragBegin(*w);
- }
- break;
- case WindowWidgetType::Scroll:
- InputScrollDragBegin(screenCoords, w, widgetIndex);
- break;
- default:
- break;
- }
- }
- break;
- case MouseState::LeftRelease:
- case MouseState::RightRelease:
- // In this switch only button presses are relevant
- break;
- }
- break;
- case InputState::WidgetPressed:
- InputStateWidgetPressed(screenCoords, state, widgetIndex, w, widget);
- break;
- case InputState::PositioningWindow:
- w = WindowFindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
- if (w == nullptr)
- {
- _inputState = InputState::Reset;
- }
- else
- {
- InputWindowPositionContinue(*w, gInputDragLast, screenCoords);
- if (state == MouseState::LeftRelease)
+ switch (state)
+ {
+ case MouseState::Released:
+ if (screenCoords.x != 0 || screenCoords.y != 0)
{
- InputWindowPositionEnd(*w, screenCoords);
+ _ticksSinceDragStart = std::nullopt;
+ InputScrollDragContinue(screenCoords, w);
}
- }
- break;
- case InputState::ViewportRight:
- if (state == MouseState::Released)
- {
- InputViewportDragContinue();
- }
- else if (state == MouseState::RightRelease)
- {
- InputViewportDragEnd();
- if (_ticksSinceDragStart.has_value() && gCurrentRealTimeTicks - _ticksSinceDragStart.value() < 500)
- {
- // If the user pressed the right mouse button for less than 500 ticks, interpret as right click
- ViewportInteractionRightClick(screenCoords);
- }
- }
- break;
- case InputState::DropdownActive:
- InputStateWidgetPressed(screenCoords, state, widgetIndex, w, widget);
- break;
- case InputState::ViewportLeft:
- w = WindowFindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
- if (w == nullptr)
- {
- _inputState = InputState::Reset;
break;
- }
+ case MouseState::RightRelease:
+ _inputState = InputState::Reset;
+ ContextShowCursor();
+ break;
+ case MouseState::LeftPress:
+ case MouseState::LeftRelease:
+ case MouseState::RightPress:
+ // Function only handles right button, so it's the only one relevant
+ break;
+ }
+ }
- switch (state)
- {
- case MouseState::Released:
- if (w->viewport == nullptr)
- {
- _inputState = InputState::Reset;
+ /**
+ *
+ * rct2: 0x006E8655
+ */
+ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState state)
+ {
+ WindowBase* w;
+ Widget* widget;
+ WidgetIndex widgetIndex;
+
+ auto* windowMgr = GetWindowManager();
+
+ // Get window and widget under cursor position
+ w = windowMgr->FindFromPoint(screenCoords);
+ widgetIndex = w == nullptr ? kWidgetIndexNull : windowMgr->FindWidgetFromPoint(*w, screenCoords);
+ widget = widgetIndex == kWidgetIndexNull ? nullptr : &w->widgets[widgetIndex];
+
+ switch (_inputState)
+ {
+ case InputState::Reset:
+ WindowTooltipReset(screenCoords);
+ // fall-through
+ case InputState::Normal:
+ switch (state)
+ {
+ case MouseState::Released:
+ InputWidgetOver(screenCoords, w, widgetIndex);
break;
- }
-
- if (!InputTestFlag(INPUT_FLAG_4))
+ case MouseState::LeftPress:
+ InputWidgetLeft(screenCoords, w, widgetIndex);
break;
+ case MouseState::RightPress:
+ windowMgr->CloseByClass(WindowClass::Tooltip);
- if (w->classification != _dragWidget.window_classification || w->number != _dragWidget.window_number
- || !(_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
- {
- break;
- }
-
- w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
- if (w == nullptr)
- {
- break;
- }
-
- w->OnToolDrag(gCurrentToolWidget.widget_index, screenCoords);
- break;
- case MouseState::LeftRelease:
- _inputState = InputState::Reset;
- if (_dragWidget.window_number == w->number)
- {
- if ((_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
+ if (w != nullptr)
{
- w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
- if (w != nullptr)
+ w = windowMgr->BringToFront(*w);
+ }
+
+ if (widgetIndex != kWidgetIndexNull)
+ {
+ switch (widget->type)
{
- w->OnToolUp(gCurrentToolWidget.widget_index, screenCoords);
+ case WindowWidgetType::Viewport:
+ if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
+ {
+ InputViewportDragBegin(*w);
+ }
+ break;
+ case WindowWidgetType::Scroll:
+ InputScrollDragBegin(screenCoords, w, widgetIndex);
+ break;
+ default:
+ break;
}
}
- else if (!(_inputFlags & INPUT_FLAG_4))
- {
- ViewportInteractionLeftClick(screenCoords);
- }
+ break;
+ case MouseState::LeftRelease:
+ case MouseState::RightRelease:
+ // In this switch only button presses are relevant
+ break;
+ }
+ break;
+ case InputState::WidgetPressed:
+ InputStateWidgetPressed(screenCoords, state, widgetIndex, w, widget);
+ break;
+ case InputState::PositioningWindow:
+ w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
+ if (w == nullptr)
+ {
+ _inputState = InputState::Reset;
+ }
+ else
+ {
+ InputWindowPositionContinue(*w, gInputDragLast, screenCoords);
+ if (state == MouseState::LeftRelease)
+ {
+ InputWindowPositionEnd(*w, screenCoords);
}
- break;
- case MouseState::LeftPress:
- case MouseState::RightPress:
- case MouseState::RightRelease:
- // In this switch only left button release is relevant
- break;
- }
- break;
- case InputState::ScrollLeft:
- switch (state)
- {
- case MouseState::Released:
- InputScrollContinue(*w, widgetIndex, screenCoords);
- break;
- case MouseState::LeftRelease:
- InputScrollEnd();
- break;
- case MouseState::LeftPress:
- case MouseState::RightPress:
- case MouseState::RightRelease:
- // In this switch only left button release is relevant
- break;
- }
- break;
- case InputState::Resizing:
- w = WindowFindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
- if (w == nullptr)
- {
- _inputState = InputState::Reset;
- }
- else
- {
- if (state == MouseState::LeftRelease)
- {
- InputWindowResizeEnd();
}
- if (state == MouseState::Released || state == MouseState::LeftRelease)
+ break;
+ case InputState::ViewportRight:
+ if (state == MouseState::Released)
{
- InputWindowResizeContinue(*w, screenCoords);
+ InputViewportDragContinue();
}
- }
- break;
- case InputState::ScrollRight:
- InputScrollRight(screenCoords, state);
- break;
+ else if (state == MouseState::RightRelease)
+ {
+ InputViewportDragEnd();
+ if (_ticksSinceDragStart.has_value() && gCurrentRealTimeTicks - _ticksSinceDragStart.value() < 500)
+ {
+ // If the user pressed the right mouse button for less than 500 ticks, interpret as right click
+ ViewportInteractionRightClick(screenCoords);
+ }
+ }
+ break;
+ case InputState::DropdownActive:
+ InputStateWidgetPressed(screenCoords, state, widgetIndex, w, widget);
+ break;
+ case InputState::ViewportLeft:
+ w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
+ if (w == nullptr)
+ {
+ _inputState = InputState::Reset;
+ break;
+ }
+
+ switch (state)
+ {
+ case MouseState::Released:
+ if (w->viewport == nullptr)
+ {
+ _inputState = InputState::Reset;
+ break;
+ }
+
+ if (!InputTestFlag(INPUT_FLAG_4))
+ break;
+
+ if (w->classification != _dragWidget.window_classification || w->number != _dragWidget.window_number
+ || !(_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
+ {
+ break;
+ }
+
+ w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
+ if (w == nullptr)
+ {
+ break;
+ }
+
+ w->OnToolDrag(gCurrentToolWidget.widget_index, screenCoords);
+ break;
+ case MouseState::LeftRelease:
+ _inputState = InputState::Reset;
+ if (_dragWidget.window_number == w->number)
+ {
+ if ((_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
+ {
+ w = windowMgr->FindByNumber(
+ gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
+ if (w != nullptr)
+ {
+ w->OnToolUp(gCurrentToolWidget.widget_index, screenCoords);
+ }
+ }
+ else if (!(_inputFlags & INPUT_FLAG_4))
+ {
+ ViewportInteractionLeftClick(screenCoords);
+ }
+ }
+ break;
+ case MouseState::LeftPress:
+ case MouseState::RightPress:
+ case MouseState::RightRelease:
+ // In this switch only left button release is relevant
+ break;
+ }
+ break;
+ case InputState::ScrollLeft:
+ switch (state)
+ {
+ case MouseState::Released:
+ InputScrollContinue(*w, widgetIndex, screenCoords);
+ break;
+ case MouseState::LeftRelease:
+ InputScrollEnd();
+ break;
+ case MouseState::LeftPress:
+ case MouseState::RightPress:
+ case MouseState::RightRelease:
+ // In this switch only left button release is relevant
+ break;
+ }
+ break;
+ case InputState::Resizing:
+ w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
+ if (w == nullptr)
+ {
+ _inputState = InputState::Reset;
+ }
+ else
+ {
+ if (state == MouseState::LeftRelease)
+ {
+ InputWindowResizeEnd();
+ }
+ if (state == MouseState::Released || state == MouseState::LeftRelease)
+ {
+ InputWindowResizeContinue(*w, screenCoords);
+ }
+ }
+ break;
+ case InputState::ScrollRight:
+ InputScrollRight(screenCoords, state);
+ break;
+ }
}
-}
#pragma region Window positioning / resizing
-void InputWindowPositionBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
-{
- _inputState = InputState::PositioningWindow;
- gInputDragLast = screenCoords - w.windowPos;
- _dragWidget.window_classification = w.classification;
- _dragWidget.window_number = w.number;
- _dragWidget.widget_index = widgetIndex;
-}
-
-static void InputWindowPositionContinue(
- WindowBase& w, const ScreenCoordsXY& lastScreenCoords, const ScreenCoordsXY& newScreenCoords)
-{
- int32_t snapProximity;
-
- snapProximity = (w.flags & WF_NO_SNAPPING) ? 0 : Config::Get().general.WindowSnapProximity;
- WindowMoveAndSnap(w, newScreenCoords - lastScreenCoords, snapProximity);
-}
-
-static void InputWindowPositionEnd(WindowBase& w, const ScreenCoordsXY& screenCoords)
-{
- _inputState = InputState::Normal;
- gTooltipCloseTimeout = 0;
- gTooltipWidget = _dragWidget;
- w.OnMoved(screenCoords);
-}
-
-static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
-{
- _inputState = InputState::Resizing;
- gInputDragLast = screenCoords;
- _dragWidget.window_classification = w.classification;
- _dragWidget.window_number = w.number;
- _dragWidget.widget_index = widgetIndex;
- _originalWindowWidth = w.width;
- _originalWindowHeight = w.height;
-}
-
-static void InputWindowResizeContinue(WindowBase& w, const ScreenCoordsXY& screenCoords)
-{
- if (screenCoords.y < static_cast(ContextGetHeight()) - 2)
+ void InputWindowPositionBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
{
- auto differentialCoords = screenCoords - gInputDragLast;
- int32_t targetWidth = _originalWindowWidth + differentialCoords.x - w.width;
- int32_t targetHeight = _originalWindowHeight + differentialCoords.y - w.height;
-
- WindowResize(w, targetWidth, targetHeight);
+ _inputState = InputState::PositioningWindow;
+ gInputDragLast = screenCoords - w.windowPos;
+ _dragWidget.window_classification = w.classification;
+ _dragWidget.window_number = w.number;
+ _dragWidget.widget_index = widgetIndex;
}
-}
-static void InputWindowResizeEnd()
-{
- _inputState = InputState::Normal;
- gTooltipCloseTimeout = 0;
- gTooltipWidget = _dragWidget;
-}
+ static void InputWindowPositionContinue(
+ WindowBase& w, const ScreenCoordsXY& lastScreenCoords, const ScreenCoordsXY& newScreenCoords)
+ {
+ int32_t snapProximity;
+
+ snapProximity = (w.flags & WF_NO_SNAPPING) ? 0 : Config::Get().general.WindowSnapProximity;
+ WindowMoveAndSnap(w, newScreenCoords - lastScreenCoords, snapProximity);
+ }
+
+ static void InputWindowPositionEnd(WindowBase& w, const ScreenCoordsXY& screenCoords)
+ {
+ _inputState = InputState::Normal;
+ gTooltipCloseTimeout = 0;
+ gTooltipWidget = _dragWidget;
+ w.OnMoved(screenCoords);
+ }
+
+ static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
+ {
+ _inputState = InputState::Resizing;
+ gInputDragLast = screenCoords;
+ _dragWidget.window_classification = w.classification;
+ _dragWidget.window_number = w.number;
+ _dragWidget.widget_index = widgetIndex;
+ _originalWindowWidth = w.width;
+ _originalWindowHeight = w.height;
+ }
+
+ static void InputWindowResizeContinue(WindowBase& w, const ScreenCoordsXY& screenCoords)
+ {
+ if (screenCoords.y < static_cast(ContextGetHeight()) - 2)
+ {
+ auto differentialCoords = screenCoords - gInputDragLast;
+ int32_t targetWidth = _originalWindowWidth + differentialCoords.x - w.width;
+ int32_t targetHeight = _originalWindowHeight + differentialCoords.y - w.height;
+
+ WindowResize(w, targetWidth, targetHeight);
+ }
+ }
+
+ static void InputWindowResizeEnd()
+ {
+ _inputState = InputState::Normal;
+ gTooltipCloseTimeout = 0;
+ gTooltipWidget = _dragWidget;
+ }
#pragma endregion
#pragma region Viewport dragging
-static void InputViewportDragBegin(WindowBase& w)
-{
- w.flags &= ~WF_SCROLLING_TO_LOCATION;
- _inputState = InputState::ViewportRight;
- _dragWidget.window_classification = w.classification;
- _dragWidget.window_number = w.number;
- _ticksSinceDragStart = gCurrentRealTimeTicks;
- auto cursorPosition = ContextGetCursorPosition();
- gInputDragLast = cursorPosition;
- if (!Config::Get().general.InvertViewportDrag)
+ static void InputViewportDragBegin(WindowBase& w)
{
- ContextHideCursor();
- }
-
- WindowUnfollowSprite(w);
- // gInputFlags |= INPUT_FLAG_5;
-}
-
-static void InputViewportDragContinue()
-{
- WindowBase* w;
- Viewport* viewport;
-
- auto newDragCoords = ContextGetCursorPosition();
-
- auto differentialCoords = newDragCoords - gInputDragLast;
- if (differentialCoords.x == 0 && differentialCoords.y == 0)
- return;
-
- w = WindowFindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
-
- // #3294: Window can be closed during a drag session, so just finish
- // the session if the window no longer exists
- if (w == nullptr)
- {
- InputViewportDragEnd();
- return;
- }
-
- viewport = w->viewport;
- if (viewport == nullptr)
- {
- ContextShowCursor();
- _inputState = InputState::Reset;
- }
- else if (differentialCoords.x != 0 || differentialCoords.y != 0)
- {
- if (!(w->flags & WF_NO_SCROLLING))
+ w.flags &= ~WF_SCROLLING_TO_LOCATION;
+ _inputState = InputState::ViewportRight;
+ _dragWidget.window_classification = w.classification;
+ _dragWidget.window_number = w.number;
+ _ticksSinceDragStart = gCurrentRealTimeTicks;
+ auto cursorPosition = ContextGetCursorPosition();
+ gInputDragLast = cursorPosition;
+ if (!Config::Get().general.InvertViewportDrag)
{
- // User dragged a scrollable viewport
+ ContextHideCursor();
+ }
- // If the drag time is less than 500 the "drag" is usually interpreted as a right click.
- // As the user moved the mouse, don't interpret it as right click in any case.
- _ticksSinceDragStart = std::nullopt;
+ WindowUnfollowSprite(w);
+ // gInputFlags |= INPUT_FLAG_5;
+ }
- // applying the zoom only with negative values avoids a "deadzone" effect where small positive value round to zero.
- const bool posX = differentialCoords.x > 0;
- const bool posY = differentialCoords.y > 0;
- differentialCoords.x = (viewport->zoom + 1).ApplyTo(-std::abs(differentialCoords.x));
- differentialCoords.y = (viewport->zoom + 1).ApplyTo(-std::abs(differentialCoords.y));
- differentialCoords.x = posX ? -differentialCoords.x : differentialCoords.x;
- differentialCoords.y = posY ? -differentialCoords.y : differentialCoords.y;
+ static void InputViewportDragContinue()
+ {
+ WindowBase* w;
+ Viewport* viewport;
- if (Config::Get().general.InvertViewportDrag)
+ auto newDragCoords = ContextGetCursorPosition();
+
+ auto differentialCoords = newDragCoords - gInputDragLast;
+ if (differentialCoords.x == 0 && differentialCoords.y == 0)
+ return;
+
+ auto* windowMgr = GetWindowManager();
+ w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
+
+ // #3294: Window can be closed during a drag session, so just finish
+ // the session if the window no longer exists
+ if (w == nullptr)
+ {
+ InputViewportDragEnd();
+ return;
+ }
+
+ viewport = w->viewport;
+ if (viewport == nullptr)
+ {
+ ContextShowCursor();
+ _inputState = InputState::Reset;
+ }
+ else if (differentialCoords.x != 0 || differentialCoords.y != 0)
+ {
+ if (!(w->flags & WF_NO_SCROLLING))
{
- w->savedViewPos -= differentialCoords;
- }
- else
- {
- w->savedViewPos += differentialCoords;
+ // User dragged a scrollable viewport
+
+ // If the drag time is less than 500 the "drag" is usually interpreted as a right click.
+ // As the user moved the mouse, don't interpret it as right click in any case.
+ _ticksSinceDragStart = std::nullopt;
+
+ // applying the zoom only with negative values avoids a "deadzone" effect where small positive value round to
+ // zero.
+ const bool posX = differentialCoords.x > 0;
+ const bool posY = differentialCoords.y > 0;
+ differentialCoords.x = (viewport->zoom + 1).ApplyTo(-std::abs(differentialCoords.x));
+ differentialCoords.y = (viewport->zoom + 1).ApplyTo(-std::abs(differentialCoords.y));
+ differentialCoords.x = posX ? -differentialCoords.x : differentialCoords.x;
+ differentialCoords.y = posY ? -differentialCoords.y : differentialCoords.y;
+
+ if (Config::Get().general.InvertViewportDrag)
+ {
+ w->savedViewPos -= differentialCoords;
+ }
+ else
+ {
+ w->savedViewPos += differentialCoords;
+ }
}
}
- }
- const CursorState* cursorState = ContextGetCursorState();
- if (cursorState->touch || Config::Get().general.InvertViewportDrag)
- {
+#ifndef __EMSCRIPTEN__
+ const CursorState* cursorState = ContextGetCursorState();
+ if (cursorState->touch || Config::Get().general.InvertViewportDrag)
+ {
+ gInputDragLast = newDragCoords;
+ }
+ else
+ {
+ ContextSetCursorPosition(gInputDragLast);
+ }
+#else
gInputDragLast = newDragCoords;
+#endif
}
- else
- {
- ContextSetCursorPosition(gInputDragLast);
- }
-}
-static void InputViewportDragEnd()
-{
- _inputState = InputState::Reset;
- ContextShowCursor();
-}
+ static void InputViewportDragEnd()
+ {
+ _inputState = InputState::Reset;
+ ContextShowCursor();
+ }
#pragma endregion
#pragma region Scroll bars
-static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
-{
- const auto& widget = w.widgets[widgetIndex];
-
- _inputState = InputState::ScrollLeft;
- gPressedWidget.window_classification = w.classification;
- gPressedWidget.window_number = w.number;
- gPressedWidget.widget_index = widgetIndex;
- gTooltipCursor = screenCoords;
-
- int32_t scroll_area, scroll_id;
- ScreenCoordsXY scrollCoords;
- scroll_id = 0; // safety
- WidgetScrollGetPart(w, &widget, screenCoords, scrollCoords, &scroll_area, &scroll_id);
-
- _currentScrollArea = scroll_area;
- _currentScrollIndex = scroll_id;
- w.OnScrollSelect(scroll_id, scroll_area);
- if (scroll_area == SCROLL_PART_VIEW)
+ static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
{
- w.OnScrollMouseDown(scroll_id, scrollCoords);
- return;
- }
+ const auto& widget = w.widgets[widgetIndex];
- const auto& widg = w.widgets[widgetIndex];
- auto& scroll = w.scrolls[scroll_id];
+ _inputState = InputState::ScrollLeft;
+ gPressedWidget.window_classification = w.classification;
+ gPressedWidget.window_number = w.number;
+ gPressedWidget.widget_index = widgetIndex;
+ gTooltipCursor = screenCoords;
- int32_t widget_width = widg.width() - 1;
- if (scroll.flags & VSCROLLBAR_VISIBLE)
- widget_width -= kScrollBarWidth + 1;
- int32_t widget_content_width = std::max(scroll.contentWidth - widget_width, 0);
+ int32_t scroll_area, scroll_id;
+ ScreenCoordsXY scrollCoords;
+ scroll_id = 0; // safety
+ WidgetScrollGetPart(w, &widget, screenCoords, scrollCoords, &scroll_area, &scroll_id);
- int32_t widget_height = widg.bottom - widg.top - 1;
- if (scroll.flags & HSCROLLBAR_VISIBLE)
- widget_height -= kScrollBarWidth + 1;
- int32_t widget_content_height = std::max(scroll.contentHeight - widget_height, 0);
+ _currentScrollArea = scroll_area;
+ _currentScrollIndex = scroll_id;
+ w.OnScrollSelect(scroll_id, scroll_area);
+ if (scroll_area == SCROLL_PART_VIEW)
+ {
+ w.OnScrollMouseDown(scroll_id, scrollCoords);
+ return;
+ }
- switch (scroll_area)
- {
- case SCROLL_PART_HSCROLLBAR_LEFT:
- scroll.contentOffsetX = std::max(scroll.contentOffsetX - 3, 0);
- break;
- case SCROLL_PART_HSCROLLBAR_RIGHT:
- scroll.contentOffsetX = std::min(scroll.contentOffsetX + 3, widget_content_width);
- break;
- case SCROLL_PART_HSCROLLBAR_LEFT_TROUGH:
- scroll.contentOffsetX = std::max(scroll.contentOffsetX - widget_width, 0);
- break;
- case SCROLL_PART_HSCROLLBAR_RIGHT_TROUGH:
- scroll.contentOffsetX = std::min(scroll.contentOffsetX + widget_width, widget_content_width);
- break;
- case SCROLL_PART_VSCROLLBAR_TOP:
- scroll.contentOffsetY = std::max(scroll.contentOffsetY - 3, 0);
- break;
- case SCROLL_PART_VSCROLLBAR_BOTTOM:
- scroll.contentOffsetY = std::min(scroll.contentOffsetY + 3, widget_content_height);
- break;
- case SCROLL_PART_VSCROLLBAR_TOP_TROUGH:
- scroll.contentOffsetY = std::max(scroll.contentOffsetY - widget_height, 0);
- break;
- case SCROLL_PART_VSCROLLBAR_BOTTOM_TROUGH:
- scroll.contentOffsetY = std::min(scroll.contentOffsetY + widget_height, widget_content_height);
- break;
- default:
- break;
- }
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WindowInvalidateByNumber(w.classification, w.number);
-}
-
-static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
-{
- int32_t scroll_part, scroll_id;
-
- const auto& widget = w.widgets[widgetIndex];
- if (w.classification != gPressedWidget.window_classification || w.number != gPressedWidget.window_number
- || widgetIndex != gPressedWidget.widget_index)
- {
- InvalidateScroll();
- return;
- }
-
- ScreenCoordsXY newScreenCoords;
- WidgetScrollGetPart(w, &widget, screenCoords, newScreenCoords, &scroll_part, &scroll_id);
-
- if (_currentScrollArea == SCROLL_PART_HSCROLLBAR_THUMB)
- {
- int32_t originalTooltipCursorX = gTooltipCursor.x;
- gTooltipCursor.x = screenCoords.x;
- InputScrollPartUpdateHThumb(w, widgetIndex, screenCoords.x - originalTooltipCursorX, scroll_id);
- return;
- }
-
- if (_currentScrollArea == SCROLL_PART_VSCROLLBAR_THUMB)
- {
- int32_t originalTooltipCursorY = gTooltipCursor.y;
- gTooltipCursor.y = screenCoords.y;
- InputScrollPartUpdateVThumb(w, widgetIndex, screenCoords.y - originalTooltipCursorY, scroll_id);
- return;
- }
-
- if (scroll_part != _currentScrollArea)
- {
- InvalidateScroll();
- return;
- }
-
- switch (scroll_part)
- {
- case SCROLL_PART_VIEW:
- w.OnScrollMouseDrag(scroll_id, newScreenCoords);
- break;
- case SCROLL_PART_HSCROLLBAR_LEFT:
- InputScrollPartUpdateHLeft(w, widgetIndex, scroll_id);
- break;
- case SCROLL_PART_HSCROLLBAR_RIGHT:
- InputScrollPartUpdateHRight(w, widgetIndex, scroll_id);
- break;
- case SCROLL_PART_VSCROLLBAR_TOP:
- InputScrollPartUpdateVTop(w, widgetIndex, scroll_id);
- break;
- case SCROLL_PART_VSCROLLBAR_BOTTOM:
- InputScrollPartUpdateVBottom(w, widgetIndex, scroll_id);
- break;
- }
-}
-
-static void InputScrollEnd()
-{
- _inputState = InputState::Reset;
- InvalidateScroll();
-}
-
-/**
- *
- * rct2: 0x006E98F2
- */
-static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t x, int32_t scroll_id)
-{
- const auto& widget = w.widgets[widgetIndex];
- auto& scroll = w.scrolls[scroll_id];
-
- if (WindowFindByNumber(w.classification, w.number) != nullptr)
- {
- int32_t newLeft;
- newLeft = scroll.contentWidth;
- newLeft *= x;
- x = widget.width() - 21;
- if (scroll.flags & VSCROLLBAR_VISIBLE)
- x -= kScrollBarWidth + 1;
- newLeft /= x;
- x = newLeft;
- scroll.flags |= HSCROLLBAR_THUMB_PRESSED;
- newLeft = scroll.contentOffsetX;
- newLeft += x;
- if (newLeft < 0)
- newLeft = 0;
- x = widget.width() - 1;
- if (scroll.flags & VSCROLLBAR_VISIBLE)
- x -= kScrollBarWidth + 1;
- x *= -1;
- x += scroll.contentWidth;
- if (x < 0)
- x = 0;
- if (newLeft > x)
- newLeft = x;
- scroll.contentOffsetX = newLeft;
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidateByNumber(w.classification, w.number, widgetIndex);
- }
-}
-
-/**
- *
- * rct2: 0x006E99A9
- */
-static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t y, int32_t scroll_id)
-{
- const auto& widget = w.widgets[widgetIndex];
- auto& scroll = w.scrolls[scroll_id];
-
- if (WindowFindByNumber(w.classification, w.number) != nullptr)
- {
- int32_t newTop;
- newTop = scroll.contentHeight;
- newTop *= y;
- y = widget.height() - 21;
- if (scroll.flags & HSCROLLBAR_VISIBLE)
- y -= kScrollBarWidth + 1;
- newTop /= y;
- y = newTop;
- scroll.flags |= VSCROLLBAR_THUMB_PRESSED;
- newTop = scroll.contentOffsetY;
- newTop += y;
- if (newTop < 0)
- newTop = 0;
- y = widget.height() - 1;
- if (scroll.flags & HSCROLLBAR_VISIBLE)
- y -= kScrollBarWidth + 1;
- y *= -1;
- y += scroll.contentHeight;
- if (y < 0)
- y = 0;
- if (newTop > y)
- newTop = y;
- scroll.contentOffsetY = newTop;
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidateByNumber(w.classification, w.number, widgetIndex);
- }
-}
-
-/**
- *
- * rct2: 0x006E9A60
- */
-static void InputScrollPartUpdateHLeft(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
-{
- if (WindowFindByNumber(w.classification, w.number) != nullptr)
- {
+ const auto& widg = w.widgets[widgetIndex];
auto& scroll = w.scrolls[scroll_id];
- scroll.flags |= HSCROLLBAR_LEFT_PRESSED;
- if (scroll.contentOffsetX >= 3)
- scroll.contentOffsetX -= 3;
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidateByNumber(w.classification, w.number, widgetIndex);
- }
-}
-/**
- *
- * rct2: 0x006E9ABF
- */
-static void InputScrollPartUpdateHRight(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
-{
- const auto& widget = w.widgets[widgetIndex];
- if (WindowFindByNumber(w.classification, w.number) != nullptr)
- {
- auto& scroll = w.scrolls[scroll_id];
- scroll.flags |= HSCROLLBAR_RIGHT_PRESSED;
- scroll.contentOffsetX += 3;
- int32_t newLeft = widget.width() - 1;
+ int32_t widget_width = widg.width() - 1;
if (scroll.flags & VSCROLLBAR_VISIBLE)
- newLeft -= kScrollBarWidth + 1;
- newLeft *= -1;
- newLeft += scroll.contentWidth;
- if (newLeft < 0)
- newLeft = 0;
- if (scroll.contentOffsetX > newLeft)
+ widget_width -= kScrollBarWidth + 1;
+ int32_t widget_content_width = std::max(scroll.contentWidth - widget_width, 0);
+
+ int32_t widget_height = widg.bottom - widg.top - 1;
+ if (scroll.flags & HSCROLLBAR_VISIBLE)
+ widget_height -= kScrollBarWidth + 1;
+ int32_t widget_content_height = std::max(scroll.contentHeight - widget_height, 0);
+
+ switch (scroll_area)
+ {
+ case SCROLL_PART_HSCROLLBAR_LEFT:
+ scroll.contentOffsetX = std::max(scroll.contentOffsetX - 3, 0);
+ break;
+ case SCROLL_PART_HSCROLLBAR_RIGHT:
+ scroll.contentOffsetX = std::min(scroll.contentOffsetX + 3, widget_content_width);
+ break;
+ case SCROLL_PART_HSCROLLBAR_LEFT_TROUGH:
+ scroll.contentOffsetX = std::max(scroll.contentOffsetX - widget_width, 0);
+ break;
+ case SCROLL_PART_HSCROLLBAR_RIGHT_TROUGH:
+ scroll.contentOffsetX = std::min(scroll.contentOffsetX + widget_width, widget_content_width);
+ break;
+ case SCROLL_PART_VSCROLLBAR_TOP:
+ scroll.contentOffsetY = std::max(scroll.contentOffsetY - 3, 0);
+ break;
+ case SCROLL_PART_VSCROLLBAR_BOTTOM:
+ scroll.contentOffsetY = std::min(scroll.contentOffsetY + 3, widget_content_height);
+ break;
+ case SCROLL_PART_VSCROLLBAR_TOP_TROUGH:
+ scroll.contentOffsetY = std::max(scroll.contentOffsetY - widget_height, 0);
+ break;
+ case SCROLL_PART_VSCROLLBAR_BOTTOM_TROUGH:
+ scroll.contentOffsetY = std::min(scroll.contentOffsetY + widget_height, widget_content_height);
+ break;
+ default:
+ break;
+ }
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateByNumber(w.classification, w.number);
+ }
+
+ static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
+ {
+ int32_t scroll_part, scroll_id;
+
+ const auto& widget = w.widgets[widgetIndex];
+ if (w.classification != gPressedWidget.window_classification || w.number != gPressedWidget.window_number
+ || widgetIndex != gPressedWidget.widget_index)
+ {
+ InvalidateScroll();
+ return;
+ }
+
+ ScreenCoordsXY newScreenCoords;
+ WidgetScrollGetPart(w, &widget, screenCoords, newScreenCoords, &scroll_part, &scroll_id);
+
+ if (_currentScrollArea == SCROLL_PART_HSCROLLBAR_THUMB)
+ {
+ int32_t originalTooltipCursorX = gTooltipCursor.x;
+ gTooltipCursor.x = screenCoords.x;
+ InputScrollPartUpdateHThumb(w, widgetIndex, screenCoords.x - originalTooltipCursorX, scroll_id);
+ return;
+ }
+
+ if (_currentScrollArea == SCROLL_PART_VSCROLLBAR_THUMB)
+ {
+ int32_t originalTooltipCursorY = gTooltipCursor.y;
+ gTooltipCursor.y = screenCoords.y;
+ InputScrollPartUpdateVThumb(w, widgetIndex, screenCoords.y - originalTooltipCursorY, scroll_id);
+ return;
+ }
+
+ if (scroll_part != _currentScrollArea)
+ {
+ InvalidateScroll();
+ return;
+ }
+
+ switch (scroll_part)
+ {
+ case SCROLL_PART_VIEW:
+ w.OnScrollMouseDrag(scroll_id, newScreenCoords);
+ break;
+ case SCROLL_PART_HSCROLLBAR_LEFT:
+ InputScrollPartUpdateHLeft(w, widgetIndex, scroll_id);
+ break;
+ case SCROLL_PART_HSCROLLBAR_RIGHT:
+ InputScrollPartUpdateHRight(w, widgetIndex, scroll_id);
+ break;
+ case SCROLL_PART_VSCROLLBAR_TOP:
+ InputScrollPartUpdateVTop(w, widgetIndex, scroll_id);
+ break;
+ case SCROLL_PART_VSCROLLBAR_BOTTOM:
+ InputScrollPartUpdateVBottom(w, widgetIndex, scroll_id);
+ break;
+ }
+ }
+
+ static void InputScrollEnd()
+ {
+ _inputState = InputState::Reset;
+ InvalidateScroll();
+ }
+
+ /**
+ *
+ * rct2: 0x006E98F2
+ */
+ static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t x, int32_t scroll_id)
+ {
+ const auto& widget = w.widgets[widgetIndex];
+ auto& scroll = w.scrolls[scroll_id];
+
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
+ {
+ int32_t newLeft;
+ newLeft = scroll.contentWidth;
+ newLeft *= x;
+ x = widget.width() - 21;
+ if (scroll.flags & VSCROLLBAR_VISIBLE)
+ x -= kScrollBarWidth + 1;
+ newLeft /= x;
+ x = newLeft;
+ scroll.flags |= HSCROLLBAR_THUMB_PRESSED;
+ newLeft = scroll.contentOffsetX;
+ newLeft += x;
+ if (newLeft < 0)
+ newLeft = 0;
+ x = widget.width() - 1;
+ if (scroll.flags & VSCROLLBAR_VISIBLE)
+ x -= kScrollBarWidth + 1;
+ x *= -1;
+ x += scroll.contentWidth;
+ if (x < 0)
+ x = 0;
+ if (newLeft > x)
+ newLeft = x;
scroll.contentOffsetX = newLeft;
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidateByNumber(w.classification, w.number, widgetIndex);
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+ windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
+ }
}
-}
-/**
- *
- * rct2: 0x006E9C37
- */
-static void InputScrollPartUpdateVTop(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
-{
- if (WindowFindByNumber(w.classification, w.number) != nullptr)
+ /**
+ *
+ * rct2: 0x006E99A9
+ */
+ static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t y, int32_t scroll_id)
{
+ const auto& widget = w.widgets[widgetIndex];
auto& scroll = w.scrolls[scroll_id];
- scroll.flags |= VSCROLLBAR_UP_PRESSED;
- if (scroll.contentOffsetY >= 3)
- scroll.contentOffsetY -= 3;
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidateByNumber(w.classification, w.number, widgetIndex);
- }
-}
-/**
- *
- * rct2: 0x006E9C96
- */
-static void InputScrollPartUpdateVBottom(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
-{
- const auto& widget = w.widgets[widgetIndex];
- if (WindowFindByNumber(w.classification, w.number) != nullptr)
- {
- auto& scroll = w.scrolls[scroll_id];
- scroll.flags |= VSCROLLBAR_DOWN_PRESSED;
- scroll.contentOffsetY += 3;
- int32_t newTop = widget.height() - 1;
- if (scroll.flags & HSCROLLBAR_VISIBLE)
- newTop -= kScrollBarWidth + 1;
- newTop *= -1;
- newTop += scroll.contentHeight;
- if (newTop < 0)
- newTop = 0;
- if (scroll.contentOffsetY > newTop)
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
+ {
+ int32_t newTop;
+ newTop = scroll.contentHeight;
+ newTop *= y;
+ y = widget.height() - 21;
+ if (scroll.flags & HSCROLLBAR_VISIBLE)
+ y -= kScrollBarWidth + 1;
+ newTop /= y;
+ y = newTop;
+ scroll.flags |= VSCROLLBAR_THUMB_PRESSED;
+ newTop = scroll.contentOffsetY;
+ newTop += y;
+ if (newTop < 0)
+ newTop = 0;
+ y = widget.height() - 1;
+ if (scroll.flags & HSCROLLBAR_VISIBLE)
+ y -= kScrollBarWidth + 1;
+ y *= -1;
+ y += scroll.contentHeight;
+ if (y < 0)
+ y = 0;
+ if (newTop > y)
+ newTop = y;
scroll.contentOffsetY = newTop;
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidateByNumber(w.classification, w.number, widgetIndex);
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+ windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
+ }
+ }
+
+ /**
+ *
+ * rct2: 0x006E9A60
+ */
+ static void InputScrollPartUpdateHLeft(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
+ {
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
+ {
+ auto& scroll = w.scrolls[scroll_id];
+ scroll.flags |= HSCROLLBAR_LEFT_PRESSED;
+ if (scroll.contentOffsetX >= 3)
+ scroll.contentOffsetX -= 3;
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+ windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
+ }
+ }
+
+ /**
+ *
+ * rct2: 0x006E9ABF
+ */
+ static void InputScrollPartUpdateHRight(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
+ {
+ const auto& widget = w.widgets[widgetIndex];
+
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
+ {
+ auto& scroll = w.scrolls[scroll_id];
+ scroll.flags |= HSCROLLBAR_RIGHT_PRESSED;
+ scroll.contentOffsetX += 3;
+ int32_t newLeft = widget.width() - 1;
+ if (scroll.flags & VSCROLLBAR_VISIBLE)
+ newLeft -= kScrollBarWidth + 1;
+ newLeft *= -1;
+ newLeft += scroll.contentWidth;
+ if (newLeft < 0)
+ newLeft = 0;
+ if (scroll.contentOffsetX > newLeft)
+ scroll.contentOffsetX = newLeft;
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+ windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
+ }
+ }
+
+ /**
+ *
+ * rct2: 0x006E9C37
+ */
+ static void InputScrollPartUpdateVTop(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
+ {
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
+ {
+ auto& scroll = w.scrolls[scroll_id];
+ scroll.flags |= VSCROLLBAR_UP_PRESSED;
+ if (scroll.contentOffsetY >= 3)
+ scroll.contentOffsetY -= 3;
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+ windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
+ }
+ }
+
+ /**
+ *
+ * rct2: 0x006E9C96
+ */
+ static void InputScrollPartUpdateVBottom(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
+ {
+ const auto& widget = w.widgets[widgetIndex];
+
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
+ {
+ auto& scroll = w.scrolls[scroll_id];
+ scroll.flags |= VSCROLLBAR_DOWN_PRESSED;
+ scroll.contentOffsetY += 3;
+ int32_t newTop = widget.height() - 1;
+ if (scroll.flags & HSCROLLBAR_VISIBLE)
+ newTop -= kScrollBarWidth + 1;
+ newTop *= -1;
+ newTop += scroll.contentHeight;
+ if (newTop < 0)
+ newTop = 0;
+ if (scroll.contentOffsetY > newTop)
+ scroll.contentOffsetY = newTop;
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+ windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
+ }
}
-}
#pragma endregion
#pragma region Widgets
-/**
- *
- * rct2: 0x006E9253
- */
-static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex)
-{
- WindowClass windowClass = WindowClass::Null;
- rct_windownumber windowNumber = 0;
- Widget* widget = nullptr;
-
- if (w != nullptr)
+ /**
+ *
+ * rct2: 0x006E9253
+ */
+ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex)
{
- windowClass = w->classification;
- windowNumber = w->number;
- widget = &w->widgets[widgetIndex];
- }
+ WindowClass windowClass = WindowClass::Null;
+ rct_windownumber windowNumber = 0;
+ Widget* widget = nullptr;
- InputWidgetOverChangeCheck(windowClass, windowNumber, widgetIndex);
+ if (w != nullptr)
+ {
+ windowClass = w->classification;
+ windowNumber = w->number;
+ widget = widgetIndex == kWidgetIndexNull ? nullptr : &w->widgets[widgetIndex];
+ }
- if (w != nullptr && widgetIndex != -1 && widget->type == WindowWidgetType::Scroll)
- {
- int32_t scroll_part, scrollId;
- ScreenCoordsXY newScreenCoords;
- WidgetScrollGetPart(*w, widget, screenCoords, newScreenCoords, &scroll_part, &scrollId);
+ InputWidgetOverChangeCheck(windowClass, windowNumber, widgetIndex);
- if (scroll_part != SCROLL_PART_VIEW)
- WindowTooltipClose();
+ if (w != nullptr && widgetIndex != kWidgetIndexNull && widget->type == WindowWidgetType::Scroll)
+ {
+ int32_t scroll_part, scrollId;
+ ScreenCoordsXY newScreenCoords;
+ WidgetScrollGetPart(*w, widget, screenCoords, newScreenCoords, &scroll_part, &scrollId);
+
+ if (scroll_part != SCROLL_PART_VIEW)
+ WindowTooltipClose();
+ else
+ {
+ w->OnScrollMouseOver(scrollId, newScreenCoords);
+ InputUpdateTooltip(w, widgetIndex, screenCoords);
+ }
+ }
else
{
- w->OnScrollMouseOver(scrollId, newScreenCoords);
InputUpdateTooltip(w, widgetIndex, screenCoords);
}
}
- else
+
+ /**
+ *
+ * rct2: 0x006E9269
+ */
+ static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, WidgetIndex widgetIndex)
{
- InputUpdateTooltip(w, widgetIndex, screenCoords);
- }
-}
+ // Prevents invalid widgets being clicked source of bug is elsewhere
+ if (widgetIndex == kWidgetIndexNull)
+ return;
-/**
- *
- * rct2: 0x006E9269
- */
-static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, WidgetIndex widgetIndex)
-{
- // Prevents invalid widgets being clicked source of bug is elsewhere
- if (widgetIndex == -1)
- return;
-
- // Check if the widget that the cursor was over, has changed
- if (windowClass != gHoverWidget.window_classification || windowNumber != gHoverWidget.window_number
- || widgetIndex != gHoverWidget.widget_index)
- {
- // Invalidate last widget cursor was on if widget is a flat button
- InputWidgetOverFlatbuttonInvalidate();
-
- // Set new cursor over widget
- gHoverWidget.window_classification = windowClass;
- gHoverWidget.window_number = windowNumber;
- gHoverWidget.widget_index = widgetIndex;
-
- // Invalidate new widget cursor is on if widget is a flat button
- if (windowClass != WindowClass::Null)
+ // Check if the widget that the cursor was over, has changed
+ if (windowClass != gHoverWidget.window_classification || windowNumber != gHoverWidget.window_number
+ || widgetIndex != gHoverWidget.widget_index)
+ {
+ // Invalidate last widget cursor was on if widget is a flat button
InputWidgetOverFlatbuttonInvalidate();
- }
-}
-/**
- * Used to invalidate flat button widgets when the mouse leaves and enters them. This should be generalised so that all widgets
- * can use this in the future.
- */
-static void InputWidgetOverFlatbuttonInvalidate()
-{
- WindowBase* w = WindowFindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number);
- if (w != nullptr)
- {
- w->OnPrepareDraw();
- if (w->widgets[gHoverWidget.widget_index].type == WindowWidgetType::FlatBtn)
- {
- WidgetInvalidateByNumber(gHoverWidget.window_classification, gHoverWidget.window_number, gHoverWidget.widget_index);
+ // Set new cursor over widget
+ gHoverWidget.window_classification = windowClass;
+ gHoverWidget.window_number = windowNumber;
+ gHoverWidget.widget_index = widgetIndex;
+
+ // Invalidate new widget cursor is on if widget is a flat button
+ if (windowClass != WindowClass::Null)
+ InputWidgetOverFlatbuttonInvalidate();
}
}
-}
-/**
- *
- * rct2: 0x006E95F9
- */
-static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex)
-{
- WindowClass windowClass = WindowClass::Null;
- rct_windownumber windowNumber = 0;
-
- if (w != nullptr)
+ /**
+ * Used to invalidate flat button widgets when the mouse leaves and enters them. This should be generalised so that all
+ * widgets can use this in the future.
+ */
+ static void InputWidgetOverFlatbuttonInvalidate()
{
- windowClass = w->classification;
- windowNumber = w->number;
- }
-
- WindowCloseByClass(WindowClass::Error);
- WindowCloseByClass(WindowClass::Tooltip);
-
- // Window might have changed position in the list, therefore find it again
- w = WindowFindByNumber(windowClass, windowNumber);
- if (w == nullptr)
- return;
-
- w = WindowBringToFront(*w);
- if (widgetIndex == -1)
- return;
-
- if (windowClass != GetCurrentTextBox().window.classification || windowNumber != GetCurrentTextBox().window.number
- || widgetIndex != GetCurrentTextBox().widget_index)
- {
- WindowCancelTextbox();
- }
-
- const auto& widget = w->widgets[widgetIndex];
-
- switch (widget.type)
- {
- case WindowWidgetType::Frame:
- case WindowWidgetType::Resize:
- if (WindowCanResize(*w)
- && (screenCoords.x >= w->windowPos.x + w->width - 19 && screenCoords.y >= w->windowPos.y + w->height - 19))
- InputWindowResizeBegin(*w, widgetIndex, screenCoords);
- break;
- case WindowWidgetType::Viewport:
- _inputState = InputState::ViewportLeft;
- gInputDragLast = screenCoords;
- _dragWidget.window_classification = windowClass;
- _dragWidget.window_number = windowNumber;
- if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
- {
- w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
- if (w != nullptr)
- {
- InputSetFlag(INPUT_FLAG_4, true);
- w->OnToolDown(gCurrentToolWidget.widget_index, screenCoords);
- }
- }
- break;
- case WindowWidgetType::Caption:
- InputWindowPositionBegin(*w, widgetIndex, screenCoords);
- break;
- case WindowWidgetType::Scroll:
- InputScrollBegin(*w, widgetIndex, screenCoords);
- break;
- case WindowWidgetType::Empty:
- case WindowWidgetType::LabelCentred:
- case WindowWidgetType::Label:
- case WindowWidgetType::Groupbox:
- case WindowWidgetType::ProgressBar:
- case WindowWidgetType::Placeholder:
- case WindowWidgetType::Last:
- // Non-interactive widget type
- break;
- case WindowWidgetType::ImgBtn:
- case WindowWidgetType::ColourBtn:
- case WindowWidgetType::TrnBtn:
- case WindowWidgetType::Tab:
- case WindowWidgetType::FlatBtn:
- case WindowWidgetType::Button:
- case WindowWidgetType::TableHeader:
- case WindowWidgetType::Spinner:
- case WindowWidgetType::DropdownMenu:
- case WindowWidgetType::CloseBox:
- case WindowWidgetType::Checkbox:
- case WindowWidgetType::TextBox:
- case WindowWidgetType::Custom:
- if (!WidgetIsDisabled(*w, widgetIndex))
- {
- OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, w->windowPos.x + widget.midX());
-
- // Set new cursor down widget
- gPressedWidget.window_classification = windowClass;
- gPressedWidget.window_number = windowNumber;
- gPressedWidget.widget_index = widgetIndex;
- _inputFlags |= INPUT_FLAG_WIDGET_PRESSED;
- _inputState = InputState::WidgetPressed;
- _clickRepeatTicks = gCurrentRealTimeTicks;
-
- WidgetInvalidateByNumber(windowClass, windowNumber, widgetIndex);
- w->OnMouseDown(widgetIndex);
- }
- break;
- }
-}
-
-/**
- *
- * rct2: 0x006ED833
- */
-void ProcessMouseOver(const ScreenCoordsXY& screenCoords)
-{
- WindowBase* window;
-
- CursorID cursorId = CursorID::Arrow;
- auto ft = Formatter();
- ft.Add(STR_NONE);
- SetMapTooltip(ft);
- window = WindowFindFromPoint(screenCoords);
-
- if (window != nullptr)
- {
- WidgetIndex widgetId = WindowFindWidgetFromPoint(*window, screenCoords);
- if (widgetId != -1)
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number);
+ if (w != nullptr)
{
- switch (window->widgets[widgetId].type)
+ w->OnPrepareDraw();
+ if (w->widgets[gHoverWidget.widget_index].type == WindowWidgetType::FlatBtn)
{
- case WindowWidgetType::Viewport:
- if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
- {
- if (ViewportInteractionLeftOver(screenCoords))
- {
- SetCursor(CursorID::HandPoint);
- return;
- }
- break;
- }
- cursorId = static_cast(gCurrentToolId);
- break;
-
- case WindowWidgetType::Frame:
- case WindowWidgetType::Resize:
- if (!(window->flags & WF_RESIZABLE))
- break;
-
- if (window->min_width == window->max_width && window->min_height == window->max_height)
- break;
-
- if (screenCoords.x < window->windowPos.x + window->width - 0x13)
- break;
-
- if (screenCoords.y < window->windowPos.y + window->height - 0x13)
- break;
-
- cursorId = CursorID::DiagonalArrows;
- break;
-
- case WindowWidgetType::Scroll:
- {
- int32_t output_scroll_area, scroll_id;
- ScreenCoordsXY scrollCoords;
- WidgetScrollGetPart(
- *window, &window->widgets[widgetId], screenCoords, scrollCoords, &output_scroll_area, &scroll_id);
- if (output_scroll_area != SCROLL_PART_VIEW)
- {
- cursorId = CursorID::Arrow;
- break;
- }
- // Same as default but with scroll_x/y
- cursorId = window->OnCursor(widgetId, scrollCoords, CursorID::Arrow);
- if (cursorId == CursorID::Undefined)
- cursorId = CursorID::Arrow;
- break;
- }
- default:
- cursorId = window->OnCursor(widgetId, screenCoords, CursorID::Arrow);
- if (cursorId == CursorID::Undefined)
- cursorId = CursorID::Arrow;
- break;
+ windowMgr->InvalidateWidgetByNumber(
+ gHoverWidget.window_classification, gHoverWidget.window_number, gHoverWidget.widget_index);
}
}
}
- ViewportInteractionRightOver(screenCoords);
- SetCursor(cursorId);
-}
-
-/**
- *
- * rct2: 0x006ED801
- */
-void ProcessMouseTool(const ScreenCoordsXY& screenCoords)
-{
- if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
+ /**
+ *
+ * rct2: 0x006E95F9
+ */
+ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex)
{
- WindowBase* w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
+ WindowClass windowClass = WindowClass::Null;
+ rct_windownumber windowNumber = 0;
+ if (w != nullptr)
+ {
+ windowClass = w->classification;
+ windowNumber = w->number;
+ }
+
+ auto* windowMgr = GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::Error);
+ windowMgr->CloseByClass(WindowClass::Tooltip);
+
+ // Window might have changed position in the list, therefore find it again
+ w = windowMgr->FindByNumber(windowClass, windowNumber);
if (w == nullptr)
- ToolCancel();
- else if (InputGetState() != InputState::ViewportRight)
- w->OnToolUpdate(gCurrentToolWidget.widget_index, screenCoords);
- }
-}
+ return;
-const std::map kColourToTip = {
- { COLOUR_BLACK, STR_COLOUR_BLACK_TIP },
- { COLOUR_GREY, STR_COLOUR_GREY_TIP },
- { COLOUR_WHITE, STR_COLOUR_WHITE_TIP },
- { COLOUR_DARK_PURPLE, STR_COLOUR_DARK_PURPLE_TIP },
- { COLOUR_LIGHT_PURPLE, STR_COLOUR_LIGHT_PURPLE_TIP },
- { COLOUR_BRIGHT_PURPLE, STR_COLOUR_BRIGHT_PURPLE_TIP },
- { COLOUR_DARK_BLUE, STR_COLOUR_DARK_BLUE_TIP },
- { COLOUR_LIGHT_BLUE, STR_COLOUR_LIGHT_BLUE_TIP },
- { COLOUR_ICY_BLUE, STR_COLOUR_ICY_BLUE_TIP },
- { COLOUR_TEAL, STR_COLOUR_TEAL_TIP },
- { COLOUR_AQUAMARINE, STR_COLOUR_AQUAMARINE_TIP },
- { COLOUR_SATURATED_GREEN, STR_COLOUR_SATURATED_GREEN_TIP },
- { COLOUR_DARK_GREEN, STR_COLOUR_DARK_GREEN_TIP },
- { COLOUR_MOSS_GREEN, STR_COLOUR_MOSS_GREEN_TIP },
- { COLOUR_BRIGHT_GREEN, STR_COLOUR_BRIGHT_GREEN_TIP },
- { COLOUR_OLIVE_GREEN, STR_COLOUR_OLIVE_GREEN_TIP },
- { COLOUR_DARK_OLIVE_GREEN, STR_COLOUR_DARK_OLIVE_GREEN_TIP },
- { COLOUR_BRIGHT_YELLOW, STR_COLOUR_BRIGHT_YELLOW_TIP },
- { COLOUR_YELLOW, STR_COLOUR_YELLOW_TIP },
- { COLOUR_DARK_YELLOW, STR_COLOUR_DARK_YELLOW_TIP },
- { COLOUR_LIGHT_ORANGE, STR_COLOUR_LIGHT_ORANGE_TIP },
- { COLOUR_DARK_ORANGE, STR_COLOUR_DARK_ORANGE_TIP },
- { COLOUR_LIGHT_BROWN, STR_COLOUR_LIGHT_BROWN_TIP },
- { COLOUR_SATURATED_BROWN, STR_COLOUR_SATURATED_BROWN_TIP },
- { COLOUR_DARK_BROWN, STR_COLOUR_DARK_BROWN_TIP },
- { COLOUR_SALMON_PINK, STR_COLOUR_SALMON_PINK_TIP },
- { COLOUR_BORDEAUX_RED, STR_COLOUR_BORDEAUX_RED_TIP },
- { COLOUR_SATURATED_RED, STR_COLOUR_SATURATED_RED_TIP },
- { COLOUR_BRIGHT_RED, STR_COLOUR_BRIGHT_RED_TIP },
- { COLOUR_DARK_PINK, STR_COLOUR_DARK_PINK_TIP },
- { COLOUR_BRIGHT_PINK, STR_COLOUR_BRIGHT_PINK_TIP },
- { COLOUR_LIGHT_PINK, STR_COLOUR_LIGHT_PINK_TIP },
- { COLOUR_DARK_OLIVE_DARK, STR_COLOUR_DARK_OLIVE_DARK_TIP },
- { COLOUR_DARK_OLIVE_LIGHT, STR_COLOUR_DARK_OLIVE_LIGHT_TIP },
- { COLOUR_SATURATED_BROWN_LIGHT, STR_COLOUR_SATURATED_BROWN_LIGHT_TIP },
- { COLOUR_BORDEAUX_RED_DARK, STR_COLOUR_BORDEAUX_RED_DARK_TIP },
- { COLOUR_BORDEAUX_RED_LIGHT, STR_COLOUR_BORDEAUX_RED_LIGHT_TIP },
- { COLOUR_GRASS_GREEN_DARK, STR_COLOUR_GRASS_GREEN_DARK_TIP },
- { COLOUR_GRASS_GREEN_LIGHT, STR_COLOUR_GRASS_GREEN_LIGHT_TIP },
- { COLOUR_OLIVE_DARK, STR_COLOUR_OLIVE_DARK_TIP },
- { COLOUR_OLIVE_LIGHT, STR_COLOUR_OLIVE_LIGHT_TIP },
- { COLOUR_SATURATED_GREEN_LIGHT, STR_COLOUR_SATURATED_GREEN_LIGHT_TIP },
- { COLOUR_TAN_DARK, STR_COLOUR_TAN_DARK_TIP },
- { COLOUR_TAN_LIGHT, STR_COLOUR_TAN_LIGHT_TIP },
- { COLOUR_DULL_PURPLE_LIGHT, STR_COLOUR_DULL_PURPLE_LIGHT_TIP },
- { COLOUR_DULL_GREEN_DARK, STR_COLOUR_DULL_GREEN_DARK_TIP },
- { COLOUR_DULL_GREEN_LIGHT, STR_COLOUR_DULL_GREEN_LIGHT_TIP },
- { COLOUR_SATURATED_PURPLE_DARK, STR_COLOUR_SATURATED_PURPLE_DARK_TIP },
- { COLOUR_SATURATED_PURPLE_LIGHT, STR_COLOUR_SATURATED_PURPLE_LIGHT_TIP },
- { COLOUR_ORANGE_LIGHT, STR_COLOUR_ORANGE_LIGHT_TIP },
- { COLOUR_AQUA_DARK, STR_COLOUR_AQUA_DARK_TIP },
- { COLOUR_MAGENTA_LIGHT, STR_COLOUR_MAGENTA_LIGHT_TIP },
- { COLOUR_DULL_BROWN_DARK, STR_COLOUR_DULL_BROWN_DARK_TIP },
- { COLOUR_DULL_BROWN_LIGHT, STR_COLOUR_DULL_BROWN_LIGHT_TIP },
- { COLOUR_INVISIBLE, STR_COLOUR_INVISIBLE_TIP },
- { COLOUR_VOID, STR_COLOUR_VOID_TIP },
-};
+ w = windowMgr->BringToFront(*w);
+ if (widgetIndex == kWidgetIndexNull)
+ return;
-/**
- *
- * rct2: 0x006E8DA7
- */
-void InputStateWidgetPressed(
- const ScreenCoordsXY& screenCoords, MouseState state, WidgetIndex widgetIndex, WindowBase* w, Widget* widget)
-{
- WindowClass cursor_w_class;
- rct_windownumber cursor_w_number;
- cursor_w_class = gPressedWidget.window_classification;
- cursor_w_number = gPressedWidget.window_number;
- WidgetIndex cursor_widgetIndex = gPressedWidget.widget_index;
-
- WindowBase* cursor_w = WindowFindByNumber(cursor_w_class, cursor_w_number);
- if (cursor_w == nullptr)
- {
- _inputState = InputState::Reset;
- return;
- }
-
- if (w != nullptr && state == MouseState::LeftRelease)
- {
- if (w->widgets[widgetIndex].type == WindowWidgetType::CloseBox && cursor_w_class == w->classification
- && cursor_w_number == w->number && widgetIndex == cursor_widgetIndex)
+ if (windowClass != GetCurrentTextBox().window.classification || windowNumber != GetCurrentTextBox().window.number
+ || widgetIndex != GetCurrentTextBox().widget_index)
{
- auto& im = GetInputManager();
- if (im.IsModifierKeyPressed(ModifierKey::shift))
- {
- gLastCloseModifier.window.number = w->number;
- gLastCloseModifier.window.classification = w->classification;
- gLastCloseModifier.modifier = CloseWindowModifier::Shift;
- }
- else if (im.IsModifierKeyPressed(ModifierKey::ctrl))
- {
- gLastCloseModifier.window.number = w->number;
- gLastCloseModifier.window.classification = w->classification;
- gLastCloseModifier.modifier = CloseWindowModifier::Control;
- }
+ WindowCancelTextbox();
+ }
+
+ const auto& widget = w->widgets[widgetIndex];
+
+ switch (widget.type)
+ {
+ case WindowWidgetType::Frame:
+ case WindowWidgetType::Resize:
+ if (WindowCanResize(*w)
+ && (screenCoords.x >= w->windowPos.x + w->width - 19 && screenCoords.y >= w->windowPos.y + w->height - 19))
+ InputWindowResizeBegin(*w, widgetIndex, screenCoords);
+ break;
+ case WindowWidgetType::Viewport:
+ _inputState = InputState::ViewportLeft;
+ gInputDragLast = screenCoords;
+ _dragWidget.window_classification = windowClass;
+ _dragWidget.window_number = windowNumber;
+ if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
+ {
+ w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
+ if (w != nullptr)
+ {
+ InputSetFlag(INPUT_FLAG_4, true);
+ w->OnToolDown(gCurrentToolWidget.widget_index, screenCoords);
+ }
+ }
+ break;
+ case WindowWidgetType::Caption:
+ InputWindowPositionBegin(*w, widgetIndex, screenCoords);
+ break;
+ case WindowWidgetType::Scroll:
+ InputScrollBegin(*w, widgetIndex, screenCoords);
+ break;
+ case WindowWidgetType::Empty:
+ case WindowWidgetType::LabelCentred:
+ case WindowWidgetType::Label:
+ case WindowWidgetType::Groupbox:
+ case WindowWidgetType::ProgressBar:
+ case WindowWidgetType::Placeholder:
+ // Non-interactive widget type
+ break;
+ case WindowWidgetType::ImgBtn:
+ case WindowWidgetType::ColourBtn:
+ case WindowWidgetType::TrnBtn:
+ case WindowWidgetType::Tab:
+ case WindowWidgetType::FlatBtn:
+ case WindowWidgetType::Button:
+ case WindowWidgetType::TableHeader:
+ case WindowWidgetType::Spinner:
+ case WindowWidgetType::DropdownMenu:
+ case WindowWidgetType::CloseBox:
+ case WindowWidgetType::Checkbox:
+ case WindowWidgetType::TextBox:
+ case WindowWidgetType::Custom:
+ if (!WidgetIsDisabled(*w, widgetIndex))
+ {
+ OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, w->windowPos.x + widget.midX());
+
+ // Set new cursor down widget
+ gPressedWidget.window_classification = windowClass;
+ gPressedWidget.window_number = windowNumber;
+ gPressedWidget.widget_index = widgetIndex;
+ _inputFlags |= INPUT_FLAG_WIDGET_PRESSED;
+ _inputState = InputState::WidgetPressed;
+ _clickRepeatTicks = gCurrentRealTimeTicks;
+
+ windowMgr->InvalidateWidgetByNumber(windowClass, windowNumber, widgetIndex);
+ w->OnMouseDown(widgetIndex);
+ }
+ break;
}
}
- switch (state)
+ /**
+ *
+ * rct2: 0x006ED833
+ */
+ void ProcessMouseOver(const ScreenCoordsXY& screenCoords)
{
- case MouseState::Released:
- if (w == nullptr || cursor_w_class != w->classification || cursor_w_number != w->number
- || widgetIndex != cursor_widgetIndex)
- break;
+ CursorID cursorId = CursorID::Arrow;
+ auto ft = Formatter();
+ ft.Add(kStringIdNone);
+ SetMapTooltip(ft);
- if (WidgetIsDisabled(*w, widgetIndex))
- break;
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindFromPoint(screenCoords);
- // If this variable is non-zero then its the last tick the mouse down event was fired.
- if (_clickRepeatTicks.has_value())
+ if (window != nullptr)
+ {
+ WidgetIndex widgetId = windowMgr->FindWidgetFromPoint(*window, screenCoords);
+ if (widgetId != kWidgetIndexNull)
{
- // The initial amount of time in ticks to wait until the first click repeat.
- constexpr auto ticksUntilRepeats = 16U;
-
- // The amount of ticks between each click repeat.
- constexpr auto eventDelayInTicks = 3U;
-
- // The amount of ticks since the last click repeat.
- const auto clickRepeatsDelta = gCurrentRealTimeTicks - _clickRepeatTicks.value();
-
- // Handle click repeat, only start this when at least 16 ticks elapsed.
- if (clickRepeatsDelta >= ticksUntilRepeats && (clickRepeatsDelta & eventDelayInTicks) == 0)
+ switch (window->widgets[widgetId].type)
{
- if (WidgetIsHoldable(*w, widgetIndex))
- {
- w->OnMouseDown(widgetIndex);
- }
+ case WindowWidgetType::Viewport:
+ if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
+ {
+ if (ViewportInteractionLeftOver(screenCoords))
+ {
+ SetCursor(CursorID::HandPoint);
+ return;
+ }
+ break;
+ }
+ cursorId = static_cast(gCurrentToolId);
+ break;
- // Subtract initial delay from here on we want the event each third tick.
- _clickRepeatTicks = gCurrentRealTimeTicks - ticksUntilRepeats;
+ case WindowWidgetType::Frame:
+ case WindowWidgetType::Resize:
+ if (!(window->flags & WF_RESIZABLE))
+ break;
+
+ if (window->min_width == window->max_width && window->min_height == window->max_height)
+ break;
+
+ if (screenCoords.x < window->windowPos.x + window->width - 0x13)
+ break;
+
+ if (screenCoords.y < window->windowPos.y + window->height - 0x13)
+ break;
+
+ cursorId = CursorID::DiagonalArrows;
+ break;
+
+ case WindowWidgetType::Scroll:
+ {
+ int32_t output_scroll_area, scroll_id;
+ ScreenCoordsXY scrollCoords;
+ WidgetScrollGetPart(
+ *window, &window->widgets[widgetId], screenCoords, scrollCoords, &output_scroll_area, &scroll_id);
+ if (output_scroll_area != SCROLL_PART_VIEW)
+ {
+ cursorId = CursorID::Arrow;
+ break;
+ }
+ // Same as default but with scroll_x/y
+ cursorId = window->OnCursor(widgetId, scrollCoords, CursorID::Arrow);
+ if (cursorId == CursorID::Undefined)
+ cursorId = CursorID::Arrow;
+ break;
+ }
+ default:
+ cursorId = window->OnCursor(widgetId, screenCoords, CursorID::Arrow);
+ if (cursorId == CursorID::Undefined)
+ cursorId = CursorID::Arrow;
+ break;
}
}
+ }
- if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
+ ViewportInteractionRightOver(screenCoords);
+ SetCursor(cursorId);
+ }
+
+ /**
+ *
+ * rct2: 0x006ED801
+ */
+ void ProcessMouseTool(const ScreenCoordsXY& screenCoords)
+ {
+ if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
+ {
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
+
+ if (w == nullptr)
+ ToolCancel();
+ else if (InputGetState() != InputState::ViewportRight)
+ w->OnToolUpdate(gCurrentToolWidget.widget_index, screenCoords);
+ }
+ }
+
+ const std::map kColourToTip = {
+ { COLOUR_BLACK, STR_COLOUR_BLACK_TIP },
+ { COLOUR_GREY, STR_COLOUR_GREY_TIP },
+ { COLOUR_WHITE, STR_COLOUR_WHITE_TIP },
+ { COLOUR_DARK_PURPLE, STR_COLOUR_DARK_PURPLE_TIP },
+ { COLOUR_LIGHT_PURPLE, STR_COLOUR_LIGHT_PURPLE_TIP },
+ { COLOUR_BRIGHT_PURPLE, STR_COLOUR_BRIGHT_PURPLE_TIP },
+ { COLOUR_DARK_BLUE, STR_COLOUR_DARK_BLUE_TIP },
+ { COLOUR_LIGHT_BLUE, STR_COLOUR_LIGHT_BLUE_TIP },
+ { COLOUR_ICY_BLUE, STR_COLOUR_ICY_BLUE_TIP },
+ { COLOUR_TEAL, STR_COLOUR_TEAL_TIP },
+ { COLOUR_AQUAMARINE, STR_COLOUR_AQUAMARINE_TIP },
+ { COLOUR_SATURATED_GREEN, STR_COLOUR_SATURATED_GREEN_TIP },
+ { COLOUR_DARK_GREEN, STR_COLOUR_DARK_GREEN_TIP },
+ { COLOUR_MOSS_GREEN, STR_COLOUR_MOSS_GREEN_TIP },
+ { COLOUR_BRIGHT_GREEN, STR_COLOUR_BRIGHT_GREEN_TIP },
+ { COLOUR_OLIVE_GREEN, STR_COLOUR_OLIVE_GREEN_TIP },
+ { COLOUR_DARK_OLIVE_GREEN, STR_COLOUR_DARK_OLIVE_GREEN_TIP },
+ { COLOUR_BRIGHT_YELLOW, STR_COLOUR_BRIGHT_YELLOW_TIP },
+ { COLOUR_YELLOW, STR_COLOUR_YELLOW_TIP },
+ { COLOUR_DARK_YELLOW, STR_COLOUR_DARK_YELLOW_TIP },
+ { COLOUR_LIGHT_ORANGE, STR_COLOUR_LIGHT_ORANGE_TIP },
+ { COLOUR_DARK_ORANGE, STR_COLOUR_DARK_ORANGE_TIP },
+ { COLOUR_LIGHT_BROWN, STR_COLOUR_LIGHT_BROWN_TIP },
+ { COLOUR_SATURATED_BROWN, STR_COLOUR_SATURATED_BROWN_TIP },
+ { COLOUR_DARK_BROWN, STR_COLOUR_DARK_BROWN_TIP },
+ { COLOUR_SALMON_PINK, STR_COLOUR_SALMON_PINK_TIP },
+ { COLOUR_BORDEAUX_RED, STR_COLOUR_BORDEAUX_RED_TIP },
+ { COLOUR_SATURATED_RED, STR_COLOUR_SATURATED_RED_TIP },
+ { COLOUR_BRIGHT_RED, STR_COLOUR_BRIGHT_RED_TIP },
+ { COLOUR_DARK_PINK, STR_COLOUR_DARK_PINK_TIP },
+ { COLOUR_BRIGHT_PINK, STR_COLOUR_BRIGHT_PINK_TIP },
+ { COLOUR_LIGHT_PINK, STR_COLOUR_LIGHT_PINK_TIP },
+ { COLOUR_DARK_OLIVE_DARK, STR_COLOUR_DARK_OLIVE_DARK_TIP },
+ { COLOUR_DARK_OLIVE_LIGHT, STR_COLOUR_DARK_OLIVE_LIGHT_TIP },
+ { COLOUR_SATURATED_BROWN_LIGHT, STR_COLOUR_SATURATED_BROWN_LIGHT_TIP },
+ { COLOUR_BORDEAUX_RED_DARK, STR_COLOUR_BORDEAUX_RED_DARK_TIP },
+ { COLOUR_BORDEAUX_RED_LIGHT, STR_COLOUR_BORDEAUX_RED_LIGHT_TIP },
+ { COLOUR_GRASS_GREEN_DARK, STR_COLOUR_GRASS_GREEN_DARK_TIP },
+ { COLOUR_GRASS_GREEN_LIGHT, STR_COLOUR_GRASS_GREEN_LIGHT_TIP },
+ { COLOUR_OLIVE_DARK, STR_COLOUR_OLIVE_DARK_TIP },
+ { COLOUR_OLIVE_LIGHT, STR_COLOUR_OLIVE_LIGHT_TIP },
+ { COLOUR_SATURATED_GREEN_LIGHT, STR_COLOUR_SATURATED_GREEN_LIGHT_TIP },
+ { COLOUR_TAN_DARK, STR_COLOUR_TAN_DARK_TIP },
+ { COLOUR_TAN_LIGHT, STR_COLOUR_TAN_LIGHT_TIP },
+ { COLOUR_DULL_PURPLE_LIGHT, STR_COLOUR_DULL_PURPLE_LIGHT_TIP },
+ { COLOUR_DULL_GREEN_DARK, STR_COLOUR_DULL_GREEN_DARK_TIP },
+ { COLOUR_DULL_GREEN_LIGHT, STR_COLOUR_DULL_GREEN_LIGHT_TIP },
+ { COLOUR_SATURATED_PURPLE_DARK, STR_COLOUR_SATURATED_PURPLE_DARK_TIP },
+ { COLOUR_SATURATED_PURPLE_LIGHT, STR_COLOUR_SATURATED_PURPLE_LIGHT_TIP },
+ { COLOUR_ORANGE_LIGHT, STR_COLOUR_ORANGE_LIGHT_TIP },
+ { COLOUR_AQUA_DARK, STR_COLOUR_AQUA_DARK_TIP },
+ { COLOUR_MAGENTA_LIGHT, STR_COLOUR_MAGENTA_LIGHT_TIP },
+ { COLOUR_DULL_BROWN_DARK, STR_COLOUR_DULL_BROWN_DARK_TIP },
+ { COLOUR_DULL_BROWN_LIGHT, STR_COLOUR_DULL_BROWN_LIGHT_TIP },
+ { COLOUR_INVISIBLE, STR_COLOUR_INVISIBLE_TIP },
+ { COLOUR_VOID, STR_COLOUR_VOID_TIP },
+ };
+
+ /**
+ *
+ * rct2: 0x006E8DA7
+ */
+ void InputStateWidgetPressed(
+ const ScreenCoordsXY& screenCoords, MouseState state, WidgetIndex widgetIndex, WindowBase* w, Widget* widget)
+ {
+ WindowClass cursor_w_class;
+ rct_windownumber cursor_w_number;
+ cursor_w_class = gPressedWidget.window_classification;
+ cursor_w_number = gPressedWidget.window_number;
+ WidgetIndex cursor_widgetIndex = gPressedWidget.widget_index;
+
+ auto* windowMgr = GetWindowManager();
+ WindowBase* cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number);
+ if (cursor_w == nullptr)
+ {
+ _inputState = InputState::Reset;
+ return;
+ }
+
+ if (w != nullptr && state == MouseState::LeftRelease)
+ {
+ if (w->widgets[widgetIndex].type == WindowWidgetType::CloseBox && cursor_w_class == w->classification
+ && cursor_w_number == w->number && widgetIndex == cursor_widgetIndex)
{
+ auto& im = GetInputManager();
+ if (im.IsModifierKeyPressed(ModifierKey::shift))
+ {
+ gLastCloseModifier.window.number = w->number;
+ gLastCloseModifier.window.classification = w->classification;
+ gLastCloseModifier.modifier = CloseWindowModifier::Shift;
+ }
+ else if (im.IsModifierKeyPressed(ModifierKey::ctrl))
+ {
+ gLastCloseModifier.window.number = w->number;
+ gLastCloseModifier.window.classification = w->classification;
+ gLastCloseModifier.modifier = CloseWindowModifier::Control;
+ }
+ }
+ }
+
+ switch (state)
+ {
+ case MouseState::Released:
+ if (w == nullptr || cursor_w_class != w->classification || cursor_w_number != w->number
+ || widgetIndex != cursor_widgetIndex)
+ break;
+
+ if (WidgetIsDisabled(*w, widgetIndex))
+ break;
+
+ // If this variable is non-zero then its the last tick the mouse down event was fired.
+ if (_clickRepeatTicks.has_value())
+ {
+ // The initial amount of time in ticks to wait until the first click repeat.
+ constexpr auto kTicksUntilRepeats = 16u;
+
+ // The amount of ticks between each click repeat.
+ constexpr auto kEventDelayInTicks = 3u;
+
+ // The amount of ticks since the last click repeat.
+ const auto clickRepeatsDelta = gCurrentRealTimeTicks - _clickRepeatTicks.value();
+
+ // Handle click repeat, only start this when at least 16 ticks elapsed.
+ if (clickRepeatsDelta >= kTicksUntilRepeats && (clickRepeatsDelta & kEventDelayInTicks) == 0)
+ {
+ if (WidgetIsHoldable(*w, widgetIndex))
+ {
+ w->OnMouseDown(widgetIndex);
+ }
+
+ // Subtract initial delay from here on we want the event each third tick.
+ _clickRepeatTicks = gCurrentRealTimeTicks - kTicksUntilRepeats;
+ }
+ }
+
+ if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
+ {
+ if (_inputState == InputState::DropdownActive)
+ {
+ gDropdownHighlightedIndex = gDropdownDefaultIndex;
+ windowMgr->InvalidateByClass(WindowClass::Dropdown);
+ }
+ return;
+ }
+
+ _inputFlags |= INPUT_FLAG_WIDGET_PRESSED;
+ windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, widgetIndex);
+ return;
+ case MouseState::LeftRelease:
+ case MouseState::RightPress:
if (_inputState == InputState::DropdownActive)
{
- gDropdownHighlightedIndex = gDropdownDefaultIndex;
- WindowInvalidateByClass(WindowClass::Dropdown);
- }
- return;
- }
-
- _inputFlags |= INPUT_FLAG_WIDGET_PRESSED;
- WidgetInvalidateByNumber(cursor_w_class, cursor_w_number, widgetIndex);
- return;
- case MouseState::LeftRelease:
- case MouseState::RightPress:
- if (_inputState == InputState::DropdownActive)
- {
- if (w != nullptr)
- {
- auto wClass = w->classification;
- auto wNumber = w->number;
- int32_t dropdown_index = 0;
- bool dropdownCleanup = false;
-
- if (w->classification == WindowClass::Dropdown)
+ if (w != nullptr)
{
- dropdown_index = DropdownIndexFromPoint(screenCoords, w);
- dropdownCleanup = dropdown_index == -1
- || (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
- || gDropdownItems[dropdown_index].IsSeparator();
- w = nullptr; // To be closed right next
- }
- else
- {
- if (cursor_w_class != w->classification || cursor_w_number != w->number
- || widgetIndex != cursor_widgetIndex)
+ auto wClass = w->classification;
+ auto wNumber = w->number;
+ int32_t dropdown_index = 0;
+ bool dropdownCleanup = false;
+
+ if (w->classification == WindowClass::Dropdown)
{
- dropdownCleanup = true;
+ dropdown_index = DropdownIndexFromPoint(screenCoords, w);
+ dropdownCleanup = dropdown_index == -1
+ || (dropdown_index < Dropdown::kItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
+ || gDropdownItems[dropdown_index].IsSeparator();
+ w = nullptr; // To be closed right next
}
else
{
- dropdown_index = -1;
- if (_inputFlags & INPUT_FLAG_DROPDOWN_STAY_OPEN)
+ if (cursor_w_class != w->classification || cursor_w_number != w->number
+ || widgetIndex != cursor_widgetIndex)
{
- if (!(_inputFlags & INPUT_FLAG_DROPDOWN_MOUSE_UP))
+ dropdownCleanup = true;
+ }
+ else
+ {
+ dropdown_index = -1;
+ if (_inputFlags & INPUT_FLAG_DROPDOWN_STAY_OPEN)
{
- _inputFlags |= INPUT_FLAG_DROPDOWN_MOUSE_UP;
- return;
+ if (!(_inputFlags & INPUT_FLAG_DROPDOWN_MOUSE_UP))
+ {
+ _inputFlags |= INPUT_FLAG_DROPDOWN_MOUSE_UP;
+ return;
+ }
}
}
}
- }
- WindowCloseByClass(WindowClass::Dropdown);
+ windowMgr->CloseByClass(WindowClass::Dropdown);
- if (dropdownCleanup)
- {
- // Update w as it will be invalid after closing the dropdown window
- w = WindowFindByNumber(wClass, wNumber);
- }
- else
- {
- cursor_w = WindowFindByNumber(cursor_w_class, cursor_w_number);
- if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
+ if (dropdownCleanup)
{
- _inputFlags &= ~INPUT_FLAG_WIDGET_PRESSED;
- WidgetInvalidateByNumber(cursor_w_class, cursor_w_number, cursor_widgetIndex);
+ // Update w as it will be invalid after closing the dropdown window
+ w = windowMgr->FindByNumber(wClass, wNumber);
}
-
- _inputState = InputState::Normal;
- gTooltipCloseTimeout = 0;
- gTooltipWidget.widget_index = cursor_widgetIndex;
- gTooltipWidget.window_classification = cursor_w_class;
- gTooltipWidget.window_number = cursor_w_number;
-
- if (dropdown_index == -1)
+ else
{
- if (!Dropdown::IsDisabled(gDropdownDefaultIndex))
+ cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number);
+ if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
{
- dropdown_index = gDropdownDefaultIndex;
+ _inputFlags &= ~INPUT_FLAG_WIDGET_PRESSED;
+ windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, cursor_widgetIndex);
}
+
+ _inputState = InputState::Normal;
+ gTooltipCloseTimeout = 0;
+ gTooltipWidget.widget_index = cursor_widgetIndex;
+ gTooltipWidget.window_classification = cursor_w_class;
+ gTooltipWidget.window_number = cursor_w_number;
+
+ if (dropdown_index == -1)
+ {
+ if (!Dropdown::IsDisabled(gDropdownDefaultIndex))
+ {
+ dropdown_index = gDropdownDefaultIndex;
+ }
+ }
+ cursor_w->OnDropdown(cursor_widgetIndex, dropdown_index);
}
- cursor_w->OnDropdown(cursor_widgetIndex, dropdown_index);
}
}
+
+ _inputState = InputState::Normal;
+
+ if (state == MouseState::RightPress)
+ {
+ return;
+ }
+
+ gTooltipCloseTimeout = 0;
+ gTooltipWidget.widget_index = cursor_widgetIndex;
+
+ if (w == nullptr)
+ break;
+
+ if (widget == nullptr)
+ break;
+
+ {
+ int32_t mid_point_x = widget->midX() + w->windowPos.x;
+ OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click2, 0, mid_point_x);
+ }
+ if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)
+ break;
+
+ if (WidgetIsDisabled(*w, widgetIndex))
+ break;
+
+ windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, widgetIndex);
+ w->OnMouseUp(widgetIndex);
+ return;
+
+ default:
+ return;
+ }
+
+ _clickRepeatTicks = std::nullopt;
+ if (_inputState != InputState::DropdownActive)
+ {
+ // Hold down widget and drag outside of area??
+ if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
+ {
+ _inputFlags &= ~INPUT_FLAG_WIDGET_PRESSED;
+ windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, cursor_widgetIndex);
}
+ return;
+ }
+ else if (gDropdownIsColour)
+ {
+ // This is ordinarily covered in InputWidgetOver but the dropdown with colours is a special case.
+ InputUpdateTooltip(w, widgetIndex, screenCoords);
+ }
- _inputState = InputState::Normal;
+ gDropdownHighlightedIndex = -1;
+ windowMgr->InvalidateByClass(WindowClass::Dropdown);
+ if (w == nullptr)
+ {
+ return;
+ }
- if (state == MouseState::RightPress)
+ if (w->classification == WindowClass::Dropdown)
+ {
+ int32_t dropdown_index = DropdownIndexFromPoint(screenCoords, w);
+ if (dropdown_index == -1)
{
return;
}
- gTooltipCloseTimeout = 0;
- gTooltipWidget.widget_index = cursor_widgetIndex;
-
- if (w == nullptr)
- break;
-
- if (widget == nullptr)
- break;
-
+ if (gDropdownIsColour && gDropdownLastColourHover != dropdown_index)
{
- int32_t mid_point_x = widget->midX() + w->windowPos.x;
- OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click2, 0, mid_point_x);
+ gDropdownLastColourHover = dropdown_index;
+ WindowTooltipClose();
+
+ WindowTooltipShow(
+ OpenRCT2String{ kColourToTip.at(ColourDropDownIndexToColour(dropdown_index)), {} }, screenCoords);
}
- if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)
- break;
- if (WidgetIsDisabled(*w, widgetIndex))
- break;
-
- WidgetInvalidateByNumber(cursor_w_class, cursor_w_number, widgetIndex);
- w->OnMouseUp(widgetIndex);
- return;
-
- default:
- return;
- }
-
- _clickRepeatTicks = std::nullopt;
- if (_inputState != InputState::DropdownActive)
- {
- // Hold down widget and drag outside of area??
- if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
- {
- _inputFlags &= ~INPUT_FLAG_WIDGET_PRESSED;
- WidgetInvalidateByNumber(cursor_w_class, cursor_w_number, cursor_widgetIndex);
- }
- return;
- }
- else if (gDropdownIsColour)
- {
- // This is ordinarily covered in InputWidgetOver but the dropdown with colours is a special case.
- InputUpdateTooltip(w, widgetIndex, screenCoords);
- }
-
- gDropdownHighlightedIndex = -1;
- WindowInvalidateByClass(WindowClass::Dropdown);
- if (w == nullptr)
- {
- return;
- }
-
- if (w->classification == WindowClass::Dropdown)
- {
- int32_t dropdown_index = DropdownIndexFromPoint(screenCoords, w);
- if (dropdown_index == -1)
- {
- return;
- }
-
- if (gDropdownIsColour && gDropdownLastColourHover != dropdown_index)
- {
- gDropdownLastColourHover = dropdown_index;
- WindowTooltipClose();
-
- WindowTooltipShow(OpenRCT2String{ kColourToTip.at(ColourDropDownIndexToColour(dropdown_index)), {} }, screenCoords);
- }
-
- if (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
- {
- return;
- }
-
- if (gDropdownItems[dropdown_index].IsSeparator())
- {
- return;
- }
-
- gDropdownHighlightedIndex = dropdown_index;
- WindowInvalidateByClass(WindowClass::Dropdown);
- }
- else
- {
- gDropdownLastColourHover = -1;
- WindowTooltipClose();
- }
-}
-
-static void InputUpdateTooltip(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
-{
- if (gTooltipWidget.window_classification == WindowClass::Null)
- {
- if (gTooltipCursor == screenCoords)
- {
- if (gCurrentRealTimeTicks >= _tooltipNotShownTimeout && w != nullptr && WidgetIsVisible(*w, widgetIndex))
+ if (dropdown_index < Dropdown::kItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
{
- gTooltipCloseTimeout = gCurrentRealTimeTicks + 8000;
- WindowTooltipOpen(w, widgetIndex, screenCoords);
+ return;
}
+
+ if (gDropdownItems[dropdown_index].IsSeparator())
+ {
+ return;
+ }
+
+ gDropdownHighlightedIndex = dropdown_index;
+ windowMgr->InvalidateByClass(WindowClass::Dropdown);
}
else
{
- ResetTooltipNotShown();
- }
-
- gTooltipCloseTimeout = gCurrentRealTimeTicks + 8000;
- gTooltipCursor = screenCoords;
- }
- else
- {
- gTooltipCursor = screenCoords;
- ResetTooltipNotShown();
-
- if (w == nullptr || gTooltipWidget.window_classification != w->classification
- || gTooltipWidget.window_number != w->number || gTooltipWidget.widget_index != widgetIndex
- || !WidgetIsVisible(*w, widgetIndex))
- {
+ gDropdownLastColourHover = -1;
WindowTooltipClose();
}
+ }
- if (gCurrentRealTimeTicks >= gTooltipCloseTimeout)
+ static void InputUpdateTooltip(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
+ {
+ if (gTooltipWidget.window_classification == WindowClass::Null)
{
- WindowCloseByClass(WindowClass::Tooltip);
+ if (gTooltipCursor == screenCoords)
+ {
+ if (gCurrentRealTimeTicks >= _tooltipNotShownTimeout && w != nullptr && widgetIndex != kWidgetIndexNull
+ && WidgetIsVisible(*w, widgetIndex))
+ {
+ gTooltipCloseTimeout = gCurrentRealTimeTicks + 8000;
+ WindowTooltipOpen(w, widgetIndex, screenCoords);
+ }
+ }
+ else
+ {
+ ResetTooltipNotShown();
+ }
+
+ gTooltipCloseTimeout = gCurrentRealTimeTicks + 8000;
+ gTooltipCursor = screenCoords;
+ }
+ else
+ {
+ gTooltipCursor = screenCoords;
+ ResetTooltipNotShown();
+
+ if (w == nullptr || gTooltipWidget.window_classification != w->classification
+ || gTooltipWidget.window_number != w->number || gTooltipWidget.widget_index != widgetIndex
+ || !WidgetIsVisible(*w, widgetIndex))
+ {
+ WindowTooltipClose();
+ }
+
+ if (gCurrentRealTimeTicks >= gTooltipCloseTimeout)
+ {
+ auto* windowMgr = GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::Tooltip);
+ }
}
}
-}
#pragma endregion
-/**
- *
- * rct2: 0x006ED990
- */
-void SetCursor(CursorID cursor_id)
-{
- assert(cursor_id != CursorID::Undefined);
- if (_inputState == InputState::Resizing)
+ /**
+ *
+ * rct2: 0x006ED990
+ */
+ void SetCursor(CursorID cursor_id)
{
- cursor_id = CursorID::DiagonalArrows;
+ assert(cursor_id != CursorID::Undefined);
+ if (_inputState == InputState::Resizing)
+ {
+ cursor_id = CursorID::DiagonalArrows;
+ }
+ ContextSetCurrentCursor(cursor_id);
}
- ContextSetCurrentCursor(cursor_id);
-}
-/**
- *
- * rct2: 0x006E876D
- */
-void InvalidateScroll()
-{
- WindowBase* w = WindowFindByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
- if (w != nullptr)
+ /**
+ *
+ * rct2: 0x006E876D
+ */
+ void InvalidateScroll()
{
- // Reset to basic scroll
- w->scrolls[_currentScrollIndex].flags &= 0xFF11;
- WindowInvalidateByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
+ if (w != nullptr)
+ {
+ // Reset to basic scroll
+ w->scrolls[_currentScrollIndex].flags &= 0xFF11;
+ windowMgr->InvalidateByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
+ }
}
-}
-/**
- * rct2: 0x00406C96
- */
-void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords)
-{
- uint32_t writeIndex = _mouseInputQueueWriteIndex;
- uint32_t nextWriteIndex = (writeIndex + 1) % std::size(_mouseInputQueue);
-
- // Check if the queue is full
- if (nextWriteIndex != _mouseInputQueueReadIndex)
+ /**
+ * rct2: 0x00406C96
+ */
+ void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords)
{
- RCTMouseData* item = &_mouseInputQueue[writeIndex];
- item->x = screenCoords.x;
- item->y = screenCoords.y;
- item->state = state;
+ uint32_t writeIndex = _mouseInputQueueWriteIndex;
+ uint32_t nextWriteIndex = (writeIndex + 1) % std::size(_mouseInputQueue);
- _mouseInputQueueWriteIndex = nextWriteIndex;
+ // Check if the queue is full
+ if (nextWriteIndex != _mouseInputQueueReadIndex)
+ {
+ RCTMouseData* item = &_mouseInputQueue[writeIndex];
+ item->x = screenCoords.x;
+ item->y = screenCoords.y;
+ item->state = state;
+
+ _mouseInputQueueWriteIndex = nextWriteIndex;
+ }
}
-}
-void GameHandleEdgeScroll()
-{
- WindowBase* mainWindow;
- int32_t scrollX, scrollY;
-
- mainWindow = WindowGetMain();
- if (mainWindow == nullptr)
- return;
- if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
- return;
- if (mainWindow->viewport == nullptr)
- return;
- if (!ContextHasFocus())
- return;
-
- scrollX = 0;
- scrollY = 0;
-
- // Scroll left / right
- const CursorState* cursorState = ContextGetCursorState();
- if (cursorState->position.x == 0)
- scrollX = -1;
- else if (cursorState->position.x >= ContextGetWidth() - 1)
- scrollX = 1;
-
- // Scroll up / down
- if (cursorState->position.y == 0)
- scrollY = -1;
- else if (cursorState->position.y >= ContextGetHeight() - 1)
- scrollY = 1;
-
- InputScrollViewport(ScreenCoordsXY(scrollX, scrollY));
-}
-
-void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords)
-{
- WindowBase* mainWindow = WindowGetMain();
- if (mainWindow == nullptr)
- return;
-
- Viewport* viewport = mainWindow->viewport;
- if (viewport == nullptr)
- return;
-
- const int32_t speed = Config::Get().general.EdgeScrollingSpeed;
-
- int32_t multiplier = viewport->zoom.ApplyTo(speed);
- int32_t dx = scrollScreenCoords.x * multiplier;
- int32_t dy = scrollScreenCoords.y * multiplier;
-
- if (scrollScreenCoords.x != 0)
+ void GameHandleEdgeScroll()
{
- // Speed up scrolling horizontally when at the edge of the map
- // so that the speed is consistent with vertical edge scrolling.
- int32_t x = mainWindow->savedViewPos.x + viewport->ViewWidth() / 2 + dx;
- int32_t y = mainWindow->savedViewPos.y + viewport->ViewHeight() / 2;
- int32_t y_dy = mainWindow->savedViewPos.y + viewport->ViewHeight() / 2 + dy;
+ WindowBase* mainWindow;
+ int32_t scrollX, scrollY;
- auto mapCoord = ViewportPosToMapPos({ x, y }, 0, viewport->rotation);
- auto mapCoord_dy = ViewportPosToMapPos({ x, y_dy }, 0, viewport->rotation);
+ mainWindow = WindowGetMain();
+ if (mainWindow == nullptr)
+ return;
+ if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
+ return;
+ if (mainWindow->viewport == nullptr)
+ return;
+ if (!ContextHasFocus())
+ return;
- // 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 < kMapMinimumXY || mapCoord.y < kMapMinimumXY)
- {
- at_map_edge = 1;
- }
- if (mapCoord_dy.x < kMapMinimumXY || mapCoord_dy.y < kMapMinimumXY)
- {
- at_map_edge_dy = 1;
- }
+ scrollX = 0;
+ scrollY = 0;
- // Clamp to the map maximum value (scenario specific)
- auto mapSizeMinus2 = GetMapSizeMinus2();
- if (mapCoord.x > mapSizeMinus2.x || mapCoord.y > mapSizeMinus2.y)
- {
- at_map_edge = 1;
- }
- if (mapCoord_dy.x > mapSizeMinus2.x || mapCoord_dy.y > mapSizeMinus2.y)
- {
- at_map_edge_dy = 1;
- }
+ // Scroll left / right
+ const CursorState* cursorState = ContextGetCursorState();
+ if (cursorState->position.x == 0)
+ scrollX = -1;
+ else if (cursorState->position.x >= ContextGetWidth() - 1)
+ scrollX = 1;
- // If we crossed the boundary, multiply the distance by 2
- if (at_map_edge && at_map_edge_dy)
- {
- dx *= 2;
- }
+ // Scroll up / down
+ if (cursorState->position.y == 0)
+ scrollY = -1;
+ else if (cursorState->position.y >= ContextGetHeight() - 1)
+ scrollY = 1;
- mainWindow->savedViewPos.x += dx;
- _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING;
+ InputScrollViewport(ScreenCoordsXY(scrollX, scrollY));
}
- if (scrollScreenCoords.y != 0)
+
+ void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords)
{
- mainWindow->savedViewPos.y += dy;
- _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING;
+ WindowBase* mainWindow = WindowGetMain();
+ if (mainWindow == nullptr)
+ return;
+
+ Viewport* viewport = mainWindow->viewport;
+ if (viewport == nullptr)
+ return;
+
+ const int32_t speed = Config::Get().general.EdgeScrollingSpeed;
+
+ int32_t multiplier = viewport->zoom.ApplyTo(speed);
+ int32_t dx = scrollScreenCoords.x * multiplier;
+ int32_t dy = scrollScreenCoords.y * multiplier;
+
+ if (scrollScreenCoords.x != 0)
+ {
+ // Speed up scrolling horizontally when at the edge of the map
+ // so that the speed is consistent with vertical edge scrolling.
+ int32_t x = mainWindow->savedViewPos.x + viewport->ViewWidth() / 2 + dx;
+ int32_t y = mainWindow->savedViewPos.y + viewport->ViewHeight() / 2;
+ int32_t y_dy = mainWindow->savedViewPos.y + viewport->ViewHeight() / 2 + dy;
+
+ 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 < kMapMinimumXY || mapCoord.y < kMapMinimumXY)
+ {
+ at_map_edge = 1;
+ }
+ if (mapCoord_dy.x < kMapMinimumXY || mapCoord_dy.y < kMapMinimumXY)
+ {
+ at_map_edge_dy = 1;
+ }
+
+ // Clamp to the map maximum value (scenario specific)
+ auto mapSizeMinus2 = GetMapSizeMinus2();
+ if (mapCoord.x > mapSizeMinus2.x || mapCoord.y > mapSizeMinus2.y)
+ {
+ at_map_edge = 1;
+ }
+ if (mapCoord_dy.x > mapSizeMinus2.x || mapCoord_dy.y > mapSizeMinus2.y)
+ {
+ at_map_edge_dy = 1;
+ }
+
+ // If we crossed the boundary, multiply the distance by 2
+ if (at_map_edge && at_map_edge_dy)
+ {
+ dx *= 2;
+ }
+
+ mainWindow->savedViewPos.x += dx;
+ _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING;
+ }
+ if (scrollScreenCoords.y != 0)
+ {
+ mainWindow->savedViewPos.y += dy;
+ _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING;
+ }
}
-}
+} // namespace OpenRCT2
diff --git a/src/openrct2-ui/input/MouseInput.h b/src/openrct2-ui/input/MouseInput.h
index 14bfda2f66..4fe8a5e99b 100644
--- a/src/openrct2-ui/input/MouseInput.h
+++ b/src/openrct2-ui/input/MouseInput.h
@@ -11,21 +11,24 @@
#include
-enum class MouseState : uint32_t
+namespace OpenRCT2
{
- Released,
- LeftPress,
- LeftRelease,
- RightPress,
- RightRelease
-};
+ enum class MouseState : uint32_t
+ {
+ Released,
+ LeftPress,
+ LeftRelease,
+ RightPress,
+ RightRelease
+ };
-extern ScreenCoordsXY gInputDragLast;
+ extern ScreenCoordsXY gInputDragLast;
-void InputWindowPositionBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
-void GameHandleInput();
-void GameHandleEdgeScroll();
+ void InputWindowPositionBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords);
+ void GameHandleInput();
+ void GameHandleEdgeScroll();
-void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords);
+ void StoreMouseInput(MouseState state, const ScreenCoordsXY& screenCoords);
-void InputScrollViewport(const ScreenCoordsXY& screenCoords);
+ void InputScrollViewport(const ScreenCoordsXY& screenCoords);
+} // namespace OpenRCT2
diff --git a/src/openrct2-ui/input/ShortcutInput.cpp b/src/openrct2-ui/input/ShortcutInput.cpp
index 21b8906aff..f49fe84bd6 100644
--- a/src/openrct2-ui/input/ShortcutInput.cpp
+++ b/src/openrct2-ui/input/ShortcutInput.cpp
@@ -20,7 +20,7 @@
using namespace OpenRCT2;
using namespace OpenRCT2::Ui;
-constexpr uint32_t UsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GUI;
+constexpr uint32_t kUsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GUI;
static uint32_t ParseModifier(std::string_view text)
{
@@ -202,7 +202,7 @@ std::string_view ShortcutInput::GetModifierName(uint32_t key, bool localised)
auto r = _keys.find(key);
if (r != _keys.end())
{
- if (localised && r->second.second != STR_NONE)
+ if (localised && r->second.second != kStringIdNone)
{
return LanguageGetString(r->second.second);
}
@@ -379,7 +379,7 @@ static bool HasModifier(uint32_t shortcut, uint32_t actual, uint32_t left, uint3
static bool CompareModifiers(uint32_t shortcut, uint32_t actual)
{
- shortcut &= UsefulModifiers;
+ shortcut &= kUsefulModifiers;
return HasModifier(shortcut, actual, KMOD_LCTRL, KMOD_RCTRL) && HasModifier(shortcut, actual, KMOD_LSHIFT, KMOD_RSHIFT)
&& HasModifier(shortcut, actual, KMOD_LALT, KMOD_RALT) && HasModifier(shortcut, actual, KMOD_LGUI, KMOD_RGUI);
}
@@ -399,7 +399,7 @@ bool ShortcutInput::Matches(const InputEvent& e) const
std::optional ShortcutInput::FromInputEvent(const InputEvent& e)
{
// Assume any side modifier (more specific configurations can be done by manually editing config file)
- auto modifiers = e.Modifiers & UsefulModifiers;
+ auto modifiers = e.Modifiers & kUsefulModifiers;
for (auto mod : { KMOD_CTRL, KMOD_SHIFT, KMOD_ALT, KMOD_GUI })
{
if (modifiers & mod)
diff --git a/src/openrct2-ui/input/ShortcutManager.cpp b/src/openrct2-ui/input/ShortcutManager.cpp
index 99562b707c..6029cea287 100644
--- a/src/openrct2-ui/input/ShortcutManager.cpp
+++ b/src/openrct2-ui/input/ShortcutManager.cpp
@@ -20,8 +20,8 @@
#include
#include
#include
-#include
#include
+#include
using namespace OpenRCT2::Ui;
@@ -174,7 +174,9 @@ void ShortcutManager::ProcessEvent(const InputEvent& e)
shortcut->Current.push_back(std::move(shortcutInput.value()));
}
_pendingShortcutChange.clear();
- WindowCloseByClass(WindowClass::ChangeKeyboardShortcut);
+
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::ChangeKeyboardShortcut);
SaveUserBindings();
}
}
@@ -227,26 +229,26 @@ void ShortcutManager::LoadUserBindings()
std::optional ShortcutManager::ConvertLegacyBinding(uint16_t binding)
{
- constexpr uint16_t nullBinding = 0xFFFF;
- constexpr uint16_t shift = 0x100;
- constexpr uint16_t ctrl = 0x200;
- constexpr uint16_t alt = 0x400;
- constexpr uint16_t cmd = 0x800;
+ constexpr uint16_t kNullBinding = 0xFFFF;
+ constexpr uint16_t kShift = 0x100;
+ constexpr uint16_t kCtrl = 0x200;
+ constexpr uint16_t kAlt = 0x400;
+ constexpr uint16_t kCmd = 0x800;
- if (binding == nullBinding)
+ if (binding == kNullBinding)
{
return std::nullopt;
}
ShortcutInput result;
result.Kind = InputDeviceKind::Keyboard;
- if (binding & shift)
+ if (binding & kShift)
result.Modifiers |= KMOD_SHIFT;
- if (binding & ctrl)
+ if (binding & kCtrl)
result.Modifiers |= KMOD_CTRL;
- if (binding & alt)
+ if (binding & kAlt)
result.Modifiers |= KMOD_ALT;
- if (binding & cmd)
+ if (binding & kCmd)
result.Modifiers |= KMOD_GUI;
result.Button = SDL_GetKeyFromScancode(static_cast(binding & 0xFF));
return result;
@@ -254,14 +256,14 @@ std::optional ShortcutManager::ConvertLegacyBinding(uint16_t bind
void ShortcutManager::LoadLegacyBindings(const fs::path& path)
{
- constexpr int32_t SUPPORTED_FILE_VERSION = 1;
- constexpr int32_t MAX_LEGACY_SHORTCUTS = 85;
+ constexpr int32_t kSupportedFileVersion = 1;
+ constexpr int32_t kMaxLegacyShortcuts = 85;
auto fs = FileStream(path, FILE_MODE_OPEN);
auto version = fs.ReadValue();
- if (version == SUPPORTED_FILE_VERSION)
+ if (version == kSupportedFileVersion)
{
- for (size_t i = 0; i < MAX_LEGACY_SHORTCUTS; i++)
+ for (size_t i = 0; i < kMaxLegacyShortcuts; i++)
{
auto value = fs.ReadValue();
auto shortcutId = GetLegacyShortcutId(i);
diff --git a/src/openrct2-ui/input/ShortcutManager.h b/src/openrct2-ui/input/ShortcutManager.h
index 52066f4c96..bbe6d9442d 100644
--- a/src/openrct2-ui/input/ShortcutManager.h
+++ b/src/openrct2-ui/input/ShortcutManager.h
@@ -57,7 +57,7 @@ namespace OpenRCT2::Ui
{
public:
std::string Id;
- StringId LocalisedName = STR_NONE;
+ StringId LocalisedName = kStringIdNone;
std::string CustomName;
std::vector Default;
std::vector Current;
diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp
index 5ad32d96cb..9a9b88b7f2 100644
--- a/src/openrct2-ui/input/Shortcuts.cpp
+++ b/src/openrct2-ui/input/Shortcuts.cpp
@@ -16,8 +16,7 @@
#include
#include
#include
-#include
-#include
+#include
#include
#include
#include
@@ -40,6 +39,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -87,8 +88,10 @@ static void ShortcutRotateConstructionObject()
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
+ auto* windowMgr = GetWindowManager();
+
// Rotate scenery
- WindowBase* w = WindowFindByClass(WindowClass::Scenery);
+ WindowBase* w = windowMgr->FindByClass(WindowClass::Scenery);
if (w != nullptr && !WidgetIsDisabled(*w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON)
&& w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WindowWidgetType::Empty)
{
@@ -97,7 +100,7 @@ static void ShortcutRotateConstructionObject()
}
// Rotate construction track piece
- w = WindowFindByClass(WindowClass::RideConstruction);
+ w = windowMgr->FindByClass(WindowClass::RideConstruction);
if (w != nullptr && !WidgetIsDisabled(*w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE)
&& w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].type != WindowWidgetType::Empty)
{
@@ -110,7 +113,7 @@ static void ShortcutRotateConstructionObject()
}
// Rotate track design preview
- w = WindowFindByClass(WindowClass::TrackDesignList);
+ w = windowMgr->FindByClass(WindowClass::TrackDesignList);
if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE)
&& w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WindowWidgetType::Empty)
{
@@ -119,7 +122,7 @@ static void ShortcutRotateConstructionObject()
}
// Rotate track design placement
- w = WindowFindByClass(WindowClass::TrackDesignPlace);
+ w = windowMgr->FindByClass(WindowClass::TrackDesignPlace);
if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE)
&& w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WindowWidgetType::Empty)
{
@@ -128,7 +131,7 @@ static void ShortcutRotateConstructionObject()
}
// Rotate park entrance
- w = WindowFindByClass(WindowClass::EditorParkEntrance);
+ w = windowMgr->FindByClass(WindowClass::EditorParkEntrance);
if (w != nullptr && !WidgetIsDisabled(*w, WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON)
&& w->widgets[WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON].type != WindowWidgetType::Empty)
{
@@ -137,7 +140,7 @@ static void ShortcutRotateConstructionObject()
}
// Rotate selected element in tile inspector
- w = WindowFindByClass(WindowClass::TileInspector);
+ w = windowMgr->FindByClass(WindowClass::TileInspector);
if (w != nullptr && !WidgetIsDisabled(*w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WindowWidgetType::Empty)
{
@@ -148,15 +151,17 @@ static void ShortcutRotateConstructionObject()
static void ShortcutRemoveTopBottomToolbarToggle()
{
+ auto* windowMgr = GetWindowManager();
+
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
{
- if (WindowFindByClass(WindowClass::TitleLogo) != nullptr)
+ if (windowMgr->FindByClass(WindowClass::TitleLogo) != nullptr)
{
- WindowCloseByClass(WindowClass::TitleLogo);
- WindowCloseByClass(WindowClass::TitleOptions);
- WindowCloseByClass(WindowClass::TitleMenu);
- WindowCloseByClass(WindowClass::TitleExit);
- WindowCloseByClass(WindowClass::TitleVersion);
+ windowMgr->CloseByClass(WindowClass::TitleLogo);
+ windowMgr->CloseByClass(WindowClass::TitleOptions);
+ windowMgr->CloseByClass(WindowClass::TitleMenu);
+ windowMgr->CloseByClass(WindowClass::TitleExit);
+ windowMgr->CloseByClass(WindowClass::TitleVersion);
}
else
{
@@ -165,11 +170,11 @@ static void ShortcutRemoveTopBottomToolbarToggle()
}
else
{
- if (WindowFindByClass(WindowClass::TopToolbar) != nullptr)
+ if (windowMgr->FindByClass(WindowClass::TopToolbar) != nullptr)
{
- WindowCloseByClass(WindowClass::Dropdown);
- WindowCloseByClass(WindowClass::TopToolbar);
- WindowCloseByClass(WindowClass::BottomToolbar);
+ windowMgr->CloseByClass(WindowClass::Dropdown);
+ windowMgr->CloseByClass(WindowClass::TopToolbar);
+ windowMgr->CloseByClass(WindowClass::BottomToolbar);
}
else
{
@@ -366,10 +371,11 @@ static void ShortcutOpenCheatWindow()
return;
// Check if window is already open
- WindowBase* window = WindowFindByClass(WindowClass::Cheats);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Cheats);
if (window != nullptr)
{
- WindowClose(*window);
+ windowMgr->Close(*window);
return;
}
ContextOpenWindow(WindowClass::Cheats);
@@ -434,11 +440,12 @@ static void ShortcutOpenSceneryPicker()
|| (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor))
return;
- WindowBase* window_scenery = WindowFindByClass(WindowClass::Scenery);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window_scenery = windowMgr->FindByClass(WindowClass::Scenery);
if (window_scenery == nullptr)
ToggleSceneryWindow();
- window_scenery = WindowFindByClass(WindowClass::Scenery);
+ window_scenery = windowMgr->FindByClass(WindowClass::Scenery);
if (window_scenery != nullptr && !WidgetIsDisabled(*window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON)
&& !gWindowSceneryEyedropperEnabled)
{
@@ -469,7 +476,8 @@ static void ShortcutScaleDown()
// Tile inspector shortcuts
static void TileInspectorMouseUp(WidgetIndex widgetIndex)
{
- auto w = WindowFindByClass(WindowClass::TileInspector);
+ auto* windowMgr = GetWindowManager();
+ auto w = windowMgr->FindByClass(WindowClass::TileInspector);
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
{
w->OnMouseUp(widgetIndex);
@@ -478,7 +486,8 @@ static void TileInspectorMouseUp(WidgetIndex widgetIndex)
static void TileInspectorMouseDown(WidgetIndex widgetIndex)
{
- auto w = WindowFindByClass(WindowClass::TileInspector);
+ auto* windowMgr = GetWindowManager();
+ auto w = windowMgr->FindByClass(WindowClass::TileInspector);
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
{
w->OnMouseDown(widgetIndex);
@@ -487,7 +496,8 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex)
static void ShortcutToggleWallSlope()
{
- WindowBase* window = WindowFindByClass(WindowClass::TileInspector);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::TileInspector);
if (window == nullptr)
{
return;
@@ -518,7 +528,8 @@ static void ShortcutToggleWallSlope()
static void ShortcutIncreaseElementHeight()
{
- WindowBase* w = WindowFindByClass(WindowClass::TileInspector);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByClass(WindowClass::TileInspector);
if (w != nullptr)
{
int action = -1;
@@ -557,7 +568,8 @@ static void ShortcutIncreaseElementHeight()
static void ShortcutDecreaseElementHeight()
{
- WindowBase* w = WindowFindByClass(WindowClass::TileInspector);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByClass(WindowClass::TileInspector);
if (w != nullptr)
{
int action = -1;
@@ -620,7 +632,8 @@ static void ShortcutConstructionTurnLeft()
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
- WindowBase* window = WindowFindByClass(WindowClass::Footpath);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutTurnLeft();
@@ -635,7 +648,9 @@ static void ShortcutConstructionTurnRight()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
- WindowBase* window = WindowFindByClass(WindowClass::Footpath);
+
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutTurnRight();
@@ -651,7 +666,8 @@ static void ShortcutConstructionSlopeUp()
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
- WindowBase* window = WindowFindByClass(WindowClass::Footpath);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutSlopeUp();
@@ -667,7 +683,8 @@ static void ShortcutConstructionBuildCurrent()
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
- WindowBase* window = WindowFindByClass(WindowClass::Footpath);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutBuildCurrent();
@@ -683,7 +700,8 @@ static void ShortcutConstructionSlopeDown()
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
- WindowBase* window = WindowFindByClass(WindowClass::Footpath);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutSlopeDown();
@@ -699,7 +717,8 @@ static void ShortcutConstructionDemolishCurrent()
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
- WindowBase* window = WindowFindByClass(WindowClass::Footpath);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutDemolishCurrent();
@@ -728,25 +747,30 @@ void ShortcutManager::RegisterDefaultShortcuts()
{
// clang-format off
// Interface
- RegisterShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", WindowCloseTop);
+ RegisterShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", []() {
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseTop();
+ });
RegisterShortcut(ShortcutId::kInterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
+ auto* windowMgr = GetWindowManager();
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR))
{
- WindowCloseAll();
+ windowMgr->CloseAll();
}
else if (GetGameState().EditorStep == EditorStep::LandscapeEditor)
{
- WindowCloseTop();
+ windowMgr->CloseTop();
}
});
RegisterShortcut(ShortcutId::kInterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
RegisterShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
- auto window = WindowFindByClass(WindowClass::Error);
+ auto* windowMgr = GetWindowManager();
+ auto window = windowMgr->FindByClass(WindowClass::Error);
if (window != nullptr)
{
- WindowClose(*window);
+ windowMgr->Close(*window);
}
else if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
{
@@ -879,10 +903,11 @@ void ShortcutManager::RegisterDefaultShortcuts()
RegisterShortcut(ShortcutId::kDebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
- auto window = WindowFindByClass(WindowClass::DebugPaint);
+ auto* windowMgr = GetWindowManager();
+ auto window = windowMgr->FindByClass(WindowClass::DebugPaint);
if (window != nullptr)
{
- WindowClose(*window);
+ windowMgr->Close(*window);
}
else
{
diff --git a/src/openrct2-ui/interface/Dropdown.h b/src/openrct2-ui/interface/Dropdown.h
index d80f3f7c16..ad494ecb5e 100644
--- a/src/openrct2-ui/interface/Dropdown.h
+++ b/src/openrct2-ui/interface/Dropdown.h
@@ -10,63 +10,70 @@
#pragma once
#include
-#include
#include
-#include
+#include
+
+struct ImageId;
namespace OpenRCT2::Dropdown
{
struct Item;
- constexpr StringId SeparatorString = 0;
- constexpr StringId FormatColourPicker = 0xFFFE;
- constexpr StringId FormatLandPicker = 0xFFFF;
- constexpr int32_t ItemsMaxSize = 512;
-
- enum Flag
- {
- CustomHeight = (1 << 6),
- StayOpen = (1 << 7)
- };
-
- bool IsChecked(int32_t index);
- bool IsDisabled(int32_t index);
- void SetChecked(int32_t index, bool value);
- void SetDisabled(int32_t index, bool value);
- void SetImage(int32_t index, ImageId image);
+ constexpr StringId kSeparatorString = 0;
+ constexpr StringId kFormatColourPicker = 0xFFFE;
+ constexpr StringId kFormatLandPicker = 0xFFFF;
+ constexpr int32_t kItemsMaxSize = 512;
} // namespace OpenRCT2::Dropdown
namespace OpenRCT2::Ui::Windows
{
extern int32_t gDropdownNumItems;
- extern Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize];
+ extern Dropdown::Item gDropdownItems[Dropdown::kItemsMaxSize];
extern bool gDropdownIsColour;
extern int32_t gDropdownLastColourHover;
extern int32_t gDropdownHighlightedIndex;
extern int32_t gDropdownDefaultIndex;
void WindowDropdownShowText(
- const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags, size_t num_items);
+ const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags, size_t num_items,
+ size_t prefRowsPerColumn = 0);
void WindowDropdownShowTextCustomWidth(
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t custom_height, uint8_t flags,
- size_t num_items, int32_t width);
+ size_t num_items, int32_t width, size_t prefRowsPerColumn = 0);
+
void WindowDropdownShowImage(
int32_t x, int32_t y, int32_t extray, ColourWithFlags 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, ColourWithFlags dropdownColour, colour_t selectedColour,
bool alwaysHideSpecialColours = false);
void WindowDropdownShowColourAvailable(
WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour, uint32_t availableColours);
- uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems);
colour_t ColourDropDownIndexToColour(uint8_t ddidx);
+
+ uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems);
} // namespace OpenRCT2::Ui::Windows
namespace OpenRCT2::Dropdown
{
+ bool IsChecked(int32_t index);
+ bool IsDisabled(int32_t index);
+ void SetChecked(int32_t index, bool value);
+ void SetDisabled(int32_t index, bool value);
+ void SetImage(int32_t index, ImageId image);
+
+ enum Flag
+ {
+ CustomHeight = (1 << 6), // never set?
+ StayOpen = (1 << 7)
+ };
+
enum class ItemFlag : uint8_t
{
IsDisabled = (1 << 0),
@@ -81,7 +88,7 @@ namespace OpenRCT2::Dropdown
constexpr bool IsSeparator() const
{
- return Format == SeparatorString;
+ return Format == kSeparatorString;
}
constexpr bool IsDisabled() const
@@ -116,7 +123,7 @@ namespace OpenRCT2::Dropdown
constexpr ItemExt Separator()
{
- return ItemExt(-1, Dropdown::SeparatorString, STR_EMPTY);
+ return ItemExt(-1, Dropdown::kSeparatorString, kStringIdEmpty);
}
template
diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp
index 470bf79a27..0f6f112733 100644
--- a/src/openrct2-ui/interface/InGameConsole.cpp
+++ b/src/openrct2-ui/interface/InGameConsole.cpp
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -41,7 +42,7 @@ static int32_t InGameConsoleGetLineHeight()
void InGameConsole::WriteInitial()
{
- InteractiveConsole::WriteLine(OPENRCT2_NAME " " OPENRCT2_VERSION);
+ InteractiveConsole::WriteLine(OPENRCT2_NAME " " kOpenRCT2Version);
InteractiveConsole::WriteLine(LanguageGetString(STR_CONSOLE_HELPER_TEXT));
InteractiveConsole::WriteLine("");
WritePrompt();
@@ -135,13 +136,13 @@ void InGameConsole::ClearInput()
_consoleCurrentLine.clear();
if (_isOpen)
{
- _consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, CONSOLE_INPUT_SIZE);
+ _consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, kConsoleInputSize);
}
}
void InGameConsole::HistoryAdd(const u8string& src)
{
- if (_consoleHistory.size() >= CONSOLE_HISTORY_SIZE)
+ if (_consoleHistory.size() >= kConsoleHistorySize)
{
_consoleHistory.pop_front();
}
@@ -201,7 +202,7 @@ void InGameConsole::Open()
_isOpen = true;
ScrollToEnd();
RefreshCaret();
- _consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, CONSOLE_INPUT_SIZE);
+ _consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, kConsoleInputSize);
}
void InGameConsole::Close()
@@ -242,9 +243,9 @@ void InGameConsole::WriteLine(const std::string& input, FormatToken colourFormat
stringOffset = splitPos + 1;
}
- if (_consoleLines.size() > CONSOLE_MAX_LINES)
+ if (_consoleLines.size() > kConsoleMaxLines)
{
- const std::size_t linesToErase = _consoleLines.size() - CONSOLE_MAX_LINES;
+ const std::size_t linesToErase = _consoleLines.size() - kConsoleMaxLines;
_consoleLines.erase(_consoleLines.begin(), _consoleLines.begin() + linesToErase);
}
}
@@ -323,7 +324,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
INSET_RECT_FLAG_BORDER_INSET);
std::string lineBuffer;
- auto screenCoords = _consoleTopLeft + ScreenCoordsXY{ CONSOLE_EDGE_PADDING, CONSOLE_EDGE_PADDING };
+ auto screenCoords = _consoleTopLeft + ScreenCoordsXY{ kConsoleEdgePadding, kConsoleEdgePadding };
// Draw text inside console
for (std::size_t i = 0; i < _consoleLines.size() && i < static_cast(maxLines); i++)
@@ -353,7 +354,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
screenCoords.y += lineHeight;
}
- screenCoords.y = _consoleBottomRight.y - lineHeight - CONSOLE_EDGE_PADDING - 1;
+ screenCoords.y = _consoleBottomRight.y - lineHeight - kConsoleEdgePadding - 1;
// Draw current line
if (textColour.colour == COLOUR_BLACK)
@@ -367,11 +368,11 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
}
// Draw caret
- if (_consoleCaretTicks < CONSOLE_CARET_FLASH_THRESHOLD)
+ if (_consoleCaretTicks < kConsoleCaretFlashThreshold)
{
auto caret = screenCoords + ScreenCoordsXY{ _caretScreenPosX, lineHeight };
uint8_t caretColour = ColourMapA[textColour.colour].lightest;
- GfxFillRect(dpi, { caret, caret + ScreenCoordsXY{ CONSOLE_CARET_WIDTH, 1 } }, caretColour);
+ GfxFillRect(dpi, { caret, caret + ScreenCoordsXY{ kConsoleCaretWidth, 1 } }, caretColour);
}
// What about border colours?
diff --git a/src/openrct2-ui/interface/InGameConsole.h b/src/openrct2-ui/interface/InGameConsole.h
index 31497b9a6c..e0d3b6b6bf 100644
--- a/src/openrct2-ui/interface/InGameConsole.h
+++ b/src/openrct2-ui/interface/InGameConsole.h
@@ -21,12 +21,12 @@ namespace OpenRCT2::Ui
class InGameConsole final : public InteractiveConsole
{
private:
- static constexpr int32_t CONSOLE_MAX_LINES = 300;
- static constexpr int32_t CONSOLE_HISTORY_SIZE = 64;
- static constexpr int32_t CONSOLE_INPUT_SIZE = 256;
- static constexpr int32_t CONSOLE_CARET_FLASH_THRESHOLD = 15;
- static constexpr int32_t CONSOLE_EDGE_PADDING = 4;
- static constexpr int32_t CONSOLE_CARET_WIDTH = 6;
+ static constexpr int32_t kConsoleMaxLines = 300;
+ static constexpr int32_t kConsoleHistorySize = 64;
+ static constexpr int32_t kConsoleInputSize = 256;
+ static constexpr int32_t kConsoleCaretFlashThreshold = 15;
+ static constexpr int32_t kConsoleEdgePadding = 4;
+ static constexpr int32_t kConsoleCaretWidth = 6;
bool _isInitialised = false;
bool _isOpen = false;
diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp
index 661168ebbb..c1d2f03ea1 100644
--- a/src/openrct2-ui/interface/LandTool.cpp
+++ b/src/openrct2-ui/interface/LandTool.cpp
@@ -68,7 +68,7 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
if (surfaceObj->Colour != TerrainSurfaceObject::kNoValue)
imageId = imageId.WithPrimary(surfaceObj->Colour);
- gDropdownItems[itemIndex].Format = Dropdown::FormatLandPicker;
+ gDropdownItems[itemIndex].Format = Dropdown::kFormatLandPicker;
Dropdown::SetImage(itemIndex, imageId);
if (i == currentSurfaceType)
{
@@ -103,7 +103,7 @@ ObjectEntryIndex LandTool::GetSurfaceStyleFromDropdownIndex(size_t index)
itemIndex++;
}
}
- return OBJECT_ENTRY_INDEX_NULL;
+ return kObjectEntryIndexNull;
}
void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryIndex currentEdgeType)
@@ -118,7 +118,7 @@ void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryI
// If fallback images are loaded, the RCT1 styles will just look like copies of already existing styles, so hide them.
if (edgeObj != nullptr && !edgeObj->UsesFallbackImages())
{
- gDropdownItems[itemIndex].Format = Dropdown::FormatLandPicker;
+ gDropdownItems[itemIndex].Format = Dropdown::kFormatLandPicker;
Dropdown::SetImage(itemIndex, ImageId(edgeObj->IconImageId));
if (i == currentEdgeType)
{
@@ -154,5 +154,5 @@ ObjectEntryIndex LandTool::GetEdgeStyleFromDropdownIndex(size_t index)
itemIndex++;
}
}
- return OBJECT_ENTRY_INDEX_NULL;
+ return kObjectEntryIndexNull;
}
diff --git a/src/openrct2-ui/interface/LandTool.h b/src/openrct2-ui/interface/LandTool.h
index 936667197b..e7cac0c701 100644
--- a/src/openrct2-ui/interface/LandTool.h
+++ b/src/openrct2-ui/interface/LandTool.h
@@ -10,6 +10,7 @@
#pragma once
#include
+#include
constexpr uint16_t kLandToolMinimumSize = 1;
constexpr uint16_t kLandToolMaximumSize = 64;
diff --git a/src/openrct2-ui/interface/Objective.cpp b/src/openrct2-ui/interface/Objective.cpp
index 702fea5992..d27e799ceb 100644
--- a/src/openrct2-ui/interface/Objective.cpp
+++ b/src/openrct2-ui/interface/Objective.cpp
@@ -37,9 +37,9 @@ namespace OpenRCT2::Ui
{
if (objective.Type == OBJECTIVE_BUILD_THE_BEST)
{
- StringId rideTypeString = STR_NONE;
+ StringId rideTypeString = kStringIdNone;
auto rideTypeId = objective.RideId;
- if (rideTypeId != RIDE_TYPE_NULL && rideTypeId < RIDE_TYPE_COUNT)
+ if (rideTypeId != kRideTypeNull && rideTypeId < RIDE_TYPE_COUNT)
{
rideTypeString = GetRideTypeDescriptor(rideTypeId).Naming.Name;
}
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui
ft.Add(objective.NumGuests);
ft.Add(DateGetTotalMonths(MONTH_OCTOBER, objective.Year));
if (objective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS)
- ft.Add(objective.MinimumExcitement);
+ ft.Add(objective.MinimumExcitement);
else
ft.Add(objective.Currency);
}
diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp
index 28dd7d7328..62bcf66c3f 100644
--- a/src/openrct2-ui/interface/Theme.cpp
+++ b/src/openrct2-ui/interface/Theme.cpp
@@ -896,7 +896,7 @@ static constexpr UIThemeWindowEntry PredefinedThemeRCT1_Entries[] =
const WindowThemeDesc* desc = GetWindowThemeDescriptor(wc);
if (desc == nullptr)
{
- return STR_EMPTY;
+ return kStringIdEmpty;
}
return desc->WindowName;
}
diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp
index 5117b7741d..7a00fa9115 100644
--- a/src/openrct2-ui/interface/ViewportInteraction.cpp
+++ b/src/openrct2-ui/interface/ViewportInteraction.cpp
@@ -11,7 +11,7 @@
#include "../ProvisionalElements.h"
#include "../UiStringIds.h"
-#include "../windows/Window.h"
+#include "../windows/Windows.h"
#include "Viewport.h"
#include "Window.h"
@@ -45,6 +45,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -467,8 +468,9 @@ namespace OpenRCT2::Ui
if (!(InputTestFlag(INPUT_FLAG_6)) || !(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)))
{
- if (WindowFindByClass(WindowClass::RideConstruction) == nullptr
- && WindowFindByClass(WindowClass::Footpath) == nullptr)
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByClass(WindowClass::RideConstruction) == nullptr
+ && windowMgr->FindByClass(WindowClass::Footpath) == nullptr)
{
info.interactionType = ViewportInteractionItem::None;
return info;
@@ -503,7 +505,7 @@ namespace OpenRCT2::Ui
{
ft.Add(STR_BROKEN);
}
- ft.Add(pathAddEntry != nullptr ? pathAddEntry->name : STR_NONE);
+ ft.Add(pathAddEntry != nullptr ? pathAddEntry->name : kStringIdNone);
SetMapTooltip(ft);
return info;
}
@@ -634,7 +636,8 @@ namespace OpenRCT2::Ui
*/
static void ViewportInteractionRemoveFootpath(const PathElement& pathElement, const CoordsXY& mapCoords)
{
- WindowBase* w = WindowFindByClass(WindowClass::Footpath);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
if (w != nullptr)
FootpathUpdateProvisional();
@@ -761,7 +764,8 @@ namespace OpenRCT2::Ui
static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int32_t maxDistance)
{
- auto* w = WindowFindFromPoint(screenCoords);
+ auto* windowMgr = GetWindowManager();
+ auto* w = windowMgr->FindFromPoint(screenCoords);
if (w == nullptr)
return nullptr;
@@ -785,7 +789,8 @@ namespace OpenRCT2::Ui
*/
CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords)
{
- WindowBase* window = WindowFindFromPoint(screenCoords);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindFromPoint(screenCoords);
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY ret{};
diff --git a/src/openrct2-ui/interface/ViewportQuery.cpp b/src/openrct2-ui/interface/ViewportQuery.cpp
index 5f7e37516a..e07ad66822 100644
--- a/src/openrct2-ui/interface/ViewportQuery.cpp
+++ b/src/openrct2-ui/interface/ViewportQuery.cpp
@@ -12,7 +12,9 @@
#include "Window.h"
#include
+#include
#include
+#include
#include
#include
#include
@@ -36,7 +38,8 @@ namespace OpenRCT2::Ui
*/
CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
{
- WindowBase* window = WindowFindFromPoint(screenCoords);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindFromPoint(screenCoords);
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY position{};
@@ -134,7 +137,8 @@ namespace OpenRCT2::Ui
CoordsXY FootpathBridgeGetInfoFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
{
// First check if we point at an entrance or exit. In that case, we would want the path coming from the entrance/exit.
- WindowBase* window = WindowFindFromPoint(screenCoords);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* window = windowMgr->FindFromPoint(screenCoords);
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY ret{};
diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp
index 240b482fd6..52002e0389 100644
--- a/src/openrct2-ui/interface/Widget.cpp
+++ b/src/openrct2-ui/interface/Widget.cpp
@@ -9,8 +9,10 @@
#include "Widget.h"
+#include
#include
#include
+#include
#include
#include
#include
@@ -225,7 +227,7 @@ namespace OpenRCT2::Ui
// Get the widget
auto& widget = w.widgets[widgetIndex];
- if (widget.type != WindowWidgetType::Tab && widget.image.GetIndex() == ImageIndexUndefined)
+ if (widget.type != WindowWidgetType::Tab && widget.image.GetIndex() == kImageIndexUndefined)
return;
if (widget.type == WindowWidgetType::Tab)
@@ -233,7 +235,7 @@ namespace OpenRCT2::Ui
if (WidgetIsDisabled(w, widgetIndex))
return;
- if (widget.image.GetIndex() == ImageIndexUndefined)
+ if (widget.image.GetIndex() == kImageIndexUndefined)
{
// Set standard tab sprite to use.
widget.image = ImageId(SPR_TAB, FilterPaletteID::PaletteNull);
@@ -344,7 +346,7 @@ namespace OpenRCT2::Ui
// Get the widget
const auto& widget = w.widgets[widgetIndex];
- if (widget.text == STR_NONE)
+ if (widget.text == kStringIdNone)
return;
auto colour = w.colours[widget.colour];
@@ -389,7 +391,7 @@ namespace OpenRCT2::Ui
// Get the widget
const auto& widget = w.widgets[widgetIndex];
- if (widget.text == STR_NONE || widget.content == kWidgetContentEmpty)
+ if (widget.text == kStringIdNone || widget.content == kWidgetContentEmpty)
return;
auto colour = w.colours[widget.colour];
@@ -455,7 +457,7 @@ namespace OpenRCT2::Ui
{
if (widget.string == nullptr || widget.string[0] == '\0')
{
- stringId = STR_NONE;
+ stringId = kStringIdNone;
formatArgs = nullptr;
}
else
@@ -483,7 +485,7 @@ namespace OpenRCT2::Ui
// Text
auto [stringId, formatArgs] = WidgetGetStringidAndArgs(widget);
- if (stringId != STR_NONE)
+ if (stringId != kStringIdNone)
{
auto colour = w.colours[widget.colour].withFlag(ColourFlag::translucent, false);
if (WidgetIsDisabled(w, widgetIndex))
@@ -559,7 +561,7 @@ namespace OpenRCT2::Ui
FilterPaletteID::PaletteDarken3);
// Draw text
- if (widget->text == STR_NONE)
+ if (widget->text == kStringIdNone)
return;
topLeft = w.windowPos + ScreenCoordsXY{ widget->left + 2, widget->top + 1 };
@@ -604,7 +606,7 @@ namespace OpenRCT2::Ui
// Draw the button
GfxFillRectInset(dpi, { topLeft, bottomRight }, colour, press);
- if (widget.text == STR_NONE)
+ if (widget.text == kStringIdNone)
return;
topLeft = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, std::max(widget.top, widget.midY() - 5) };
@@ -650,7 +652,7 @@ namespace OpenRCT2::Ui
}
// draw the text
- if (widget.text == STR_NONE)
+ if (widget.text == kStringIdNone)
return;
auto [stringId, formatArgs] = WidgetGetStringidAndArgs(widget);
@@ -939,9 +941,11 @@ namespace OpenRCT2::Ui
int32_t* output_scroll_area, int32_t* scroll_id)
{
*scroll_id = 0;
- for (Widget* iterator = w.widgets; iterator != widget; iterator++)
+ auto itLast = std::find_if(
+ w.widgets.begin(), w.widgets.end(), [&](auto& otherWidget) { return &otherWidget == widget; });
+ for (auto it = w.widgets.begin(); it != itLast; it++)
{
- if (iterator->type == WindowWidgetType::Scroll)
+ if (it->type == WindowWidgetType::Scroll)
{
*scroll_id += 1;
}
@@ -1044,20 +1048,13 @@ namespace OpenRCT2::Ui
Widget* GetWidgetByIndex(const WindowBase& w, WidgetIndex widgetIndex)
{
- // Make sure we don't go out of bounds if we are given a bad widget index
- WidgetIndex index = 0;
- for (auto* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
+ if (widgetIndex >= w.widgets.size())
{
- if (index == widgetIndex)
- {
- return widget;
- }
- index++;
+ LOG_ERROR("Widget index %i out of bounds for window class %u", widgetIndex, w.classification);
}
- LOG_ERROR("Widget index %i out of bounds for window class %u", widgetIndex, w.classification);
-
- return nullptr;
+ // FIXME: This const_cast is bad.
+ return const_cast(w.widgets.data() + widgetIndex);
}
static void SafeSetWidgetFlag(WindowBase& w, WidgetIndex widgetIndex, WidgetFlags mask, bool value)
diff --git a/src/openrct2-ui/interface/Widget.h b/src/openrct2-ui/interface/Widget.h
index 8a085ffae5..1404c9108a 100644
--- a/src/openrct2-ui/interface/Widget.h
+++ b/src/openrct2-ui/interface/Widget.h
@@ -19,7 +19,7 @@ namespace OpenRCT2::Ui
{
// 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::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, kStringIdNone }, \
{ WindowWidgetType::Caption, 0, 1, WIDTH - 2, 1, 14, TITLE, STR_WINDOW_TITLE_TIP }, \
{ WindowWidgetType::CloseBox, 0, WIDTH - 13, WIDTH - 3, 2, 13, CLOSE_STR, STR_CLOSE_WINDOW_TIP }
@@ -30,7 +30,6 @@ namespace OpenRCT2::Ui
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 uint32_t kWidgetContentEmpty = 0xFFFFFFFF;
constexpr auto kBarBlink = (1u << 31);
constexpr uint8_t kScrollBarWidth = 10;
@@ -53,7 +52,7 @@ namespace OpenRCT2::Ui
constexpr Widget MakeWidget(
const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour,
- uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
+ uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
{
Widget out = {};
out.left = origin.x;
@@ -70,7 +69,7 @@ namespace OpenRCT2::Ui
constexpr Widget MakeWidget(
const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageId image,
- StringId tooltip = STR_NONE)
+ StringId tooltip = kStringIdNone)
{
Widget out = {};
out.left = origin.x;
@@ -87,17 +86,17 @@ namespace OpenRCT2::Ui
constexpr Widget MakeRemapWidget(
const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageIndex content,
- StringId tooltip = STR_NONE)
+ StringId tooltip = kStringIdNone)
{
return MakeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::PaletteNull), tooltip);
}
- constexpr Widget MakeTab(const ScreenCoordsXY& origin, StringId tooltip = STR_NONE)
+ constexpr Widget MakeTab(const ScreenCoordsXY& origin, StringId tooltip = kStringIdNone)
{
const ScreenSize size = kTabSize;
const WindowWidgetType type = WindowWidgetType::Tab;
const WindowColour colour = WindowColour::Secondary;
- const auto content = ImageId(ImageIndexUndefined);
+ const auto content = ImageId(kImageIndexUndefined);
return MakeWidget(origin, size, type, colour, content, tooltip);
}
@@ -114,7 +113,7 @@ namespace OpenRCT2::Ui
out.type = WindowWidgetType::ProgressBar;
out.colour = colour;
out.content = 0 | (lowerBlinkBound << 8) | (upperBlinkBound << 16);
- out.tooltip = STR_NONE;
+ out.tooltip = kStringIdNone;
return out;
}
@@ -126,7 +125,7 @@ namespace OpenRCT2::Ui
constexpr Widget MakeSpinnerDecreaseWidget(
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
- [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
+ [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
{
const int16_t xPos = origin.x + size.width - 26;
const int16_t yPos = origin.y + 1;
@@ -138,7 +137,7 @@ namespace OpenRCT2::Ui
constexpr Widget MakeSpinnerIncreaseWidget(
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
- [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
+ [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
{
const int16_t xPos = origin.x + size.width - 13;
const int16_t yPos = origin.y + 1;
@@ -153,14 +152,14 @@ namespace OpenRCT2::Ui
constexpr Widget MakeDropdownBoxWidget(
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
- [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
+ [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
{
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 = kWidgetContentEmpty, StringId tooltip = STR_NONE)
+ [[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
{
const int16_t xPos = origin.x + size.width - 11;
const int16_t yPos = origin.y + 1;
diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp
index 8b8845f365..3216a66a1c 100644
--- a/src/openrct2-ui/interface/Window.cpp
+++ b/src/openrct2-ui/interface/Window.cpp
@@ -15,7 +15,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -28,699 +28,545 @@
#include
#include
#include
-#include
+#include
#include
-using namespace OpenRCT2;
-using namespace OpenRCT2::Ui;
-
-// The amount of pixels to scroll per wheel click
-constexpr int32_t WindowScrollPixels = 17;
-
-static int32_t _previousAbsoluteWheel = 0;
-
-static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
+namespace OpenRCT2
{
- for (auto& w : g_window_list)
- {
- if (w->flags & WF_DEAD)
- continue;
- if (w->flags & WF_STICK_TO_BACK)
- continue;
+ using namespace OpenRCT2::Ui;
- if (loc.x + width <= w->windowPos.x)
- continue;
- if (loc.x >= w->windowPos.x + w->width)
- continue;
- if (loc.y + height <= w->windowPos.y)
- continue;
- if (loc.y >= w->windowPos.y + w->height)
- continue;
- return false;
+ // The amount of pixels to scroll per wheel click
+ constexpr int32_t kWindowScrollPixels = 17;
+
+ static int32_t _previousAbsoluteWheel = 0;
+
+ static int32_t WindowGetWidgetIndex(const WindowBase& w, Widget* widget)
+ {
+ const auto it = std::find_if(
+ w.widgets.begin(), w.widgets.end(), [&](auto& otherWidget) { return &otherWidget == widget; });
+ if (it == w.widgets.end())
+ return -1;
+ return std::distance(w.widgets.begin(), it);
}
- return true;
-}
-
-static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
-{
- if (loc.x < 0)
- return false;
- if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
- return false;
- if (loc.x + width > ContextGetWidth())
- return false;
- if (loc.y + height > ContextGetHeight())
- return false;
- return WindowFitsBetweenOthers(loc, width, height);
-}
-
-static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
-{
- uint16_t screenWidth = ContextGetWidth();
- uint16_t screenHeight = ContextGetHeight();
- int32_t unk;
-
- unk = -(width / 4);
- if (loc.x < unk)
- return false;
- unk = screenWidth + (unk * 2);
- if (loc.x > unk)
- return false;
- if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
- return false;
- unk = screenHeight - (height / 4);
- if (loc.y > unk)
- return false;
- return WindowFitsBetweenOthers(loc, width, height);
-}
-
-static ScreenCoordsXY ClampWindowToScreen(
- const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width, const int32_t height)
-{
- auto screenPos = pos;
- if (width > screenWidth || screenPos.x < 0)
- screenPos.x = 0;
- else if (screenPos.x + width > screenWidth)
- screenPos.x = screenWidth - width;
-
- auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1);
- if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
- screenPos.y = toolbarAllowance;
- else if (screenPos.y + height - toolbarAllowance > screenHeight)
- screenPos.y = screenHeight + toolbarAllowance - height;
-
- return screenPos;
-}
-
-static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
-{
- auto uiContext = GetContext()->GetUiContext();
- auto screenWidth = uiContext->GetWidth();
- auto screenHeight = uiContext->GetHeight();
-
- // Place window in an empty corner of the screen
- const ScreenCoordsXY cornerPositions[] = {
- { 0, 30 }, // topLeft
- { screenWidth - width, 30 }, // topRight
- { 0, screenHeight - 34 - height }, // bottomLeft
- { screenWidth - width, screenHeight - 34 - height }, // bottomRight
- };
-
- for (const auto& cornerPos : cornerPositions)
+ static int32_t WindowGetScrollIndex(const WindowBase& w, int32_t targetWidgetIndex)
{
- if (WindowFitsWithinSpace(cornerPos, width, height))
+ if (w.widgets[targetWidgetIndex].type != WindowWidgetType::Scroll)
+ return -1;
+
+ int32_t scrollIndex = 0;
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
{
- return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
+ if (widgetIndex == targetWidgetIndex)
+ break;
+ auto& widget = w.widgets[widgetIndex];
+ if (widget.type == WindowWidgetType::Scroll)
+ scrollIndex++;
}
+
+ return scrollIndex;
}
- // Place window next to another
- for (auto& w : g_window_list)
+ static Widget* WindowGetScrollWidget(const WindowBase& w, int32_t scrollIndex)
{
- if (w->flags & WF_DEAD)
- continue;
- if (w->flags & WF_STICK_TO_BACK)
- continue;
-
- const ScreenCoordsXY offsets[] = {
- { w->width + 2, 0 },
- { -w->width - 2, 0 },
- { 0, w->height + 2 },
- { 0, -w->height - 2 },
- { w->width + 2, -w->height - 2 },
- { -w->width - 2, -w->height - 2 },
- { w->width + 2, w->height + 2 },
- { -w->width - 2, w->height + 2 },
- };
-
- for (const auto& offset : offsets)
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
{
- auto screenPos = w->windowPos + offset;
- if (WindowFitsWithinSpace(screenPos, width, height))
- {
- return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
- }
+ auto& widget = w.widgets[widgetIndex];
+ if (widget.type != WindowWidgetType::Scroll)
+ continue;
+
+ if (scrollIndex == 0)
+ return const_cast(&widget);
+ scrollIndex--;
}
+
+ return nullptr;
}
- // Overlap
- for (auto& w : g_window_list)
+ /**
+ *
+ * rct2: 0x006E78E3
+ */
+ static void WindowScrollWheelInput(WindowBase& w, int32_t scrollIndex, int32_t wheel)
{
- if (w->flags & WF_DEAD)
- continue;
- if (w->flags & WF_STICK_TO_BACK)
- continue;
+ auto& scroll = w.scrolls[scrollIndex];
+ Widget* widget = WindowGetScrollWidget(w, scrollIndex);
+ WidgetIndex widgetIndex = WindowGetWidgetIndex(w, widget);
- const ScreenCoordsXY offsets[] = {
- { w->width + 2, 0 },
- { -w->width - 2, 0 },
- { 0, w->height + 2 },
- { 0, -w->height - 2 },
- };
-
- for (const auto& offset : offsets)
- {
- auto screenPos = w->windowPos + offset;
- if (WindowFitsOnScreen(screenPos, width, height))
- {
- return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
- }
- }
- }
-
- // Cascade
- auto screenPos = ScreenCoordsXY{ 0, 30 };
- for (auto& w : g_window_list)
- {
- if (screenPos == w->windowPos)
- {
- screenPos.x += 5;
- screenPos.y += 5;
- }
- }
-
- return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
-}
-
-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(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
-}
-
-static int32_t WindowGetWidgetIndex(const WindowBase& w, Widget* widget)
-{
- int32_t i = 0;
- for (Widget* widget2 = w.widgets; widget2->type != WindowWidgetType::Last; widget2++, i++)
- if (widget == widget2)
- return i;
- return -1;
-}
-
-static int32_t WindowGetScrollIndex(const WindowBase& w, int32_t targetWidgetIndex)
-{
- if (w.widgets[targetWidgetIndex].type != WindowWidgetType::Scroll)
- return -1;
-
- int32_t scrollIndex = 0;
- WidgetIndex widgetIndex = 0;
- for (Widget* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++, widgetIndex++)
- {
- if (widgetIndex == targetWidgetIndex)
- break;
- if (widget->type == WindowWidgetType::Scroll)
- scrollIndex++;
- }
-
- return scrollIndex;
-}
-
-static Widget* WindowGetScrollWidget(const WindowBase& w, int32_t scrollIndex)
-{
- for (Widget* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
- {
- if (widget->type != WindowWidgetType::Scroll)
- continue;
-
- if (scrollIndex == 0)
- return widget;
- scrollIndex--;
- }
-
- return nullptr;
-}
-
-/**
- *
- * rct2: 0x006E78E3
- */
-static void WindowScrollWheelInput(WindowBase& w, int32_t scrollIndex, int32_t wheel)
-{
- auto& scroll = w.scrolls[scrollIndex];
- Widget* widget = WindowGetScrollWidget(w, scrollIndex);
- WidgetIndex widgetIndex = WindowGetWidgetIndex(w, widget);
-
- if (scroll.flags & VSCROLLBAR_VISIBLE)
- {
- int32_t size = widget->height() - 1;
- if (scroll.flags & HSCROLLBAR_VISIBLE)
- size -= 11;
- size = std::max(0, scroll.contentHeight - size);
- scroll.contentOffsetY = std::min(std::max(0, scroll.contentOffsetY + wheel), size);
- }
- else
- {
- int32_t size = widget->width() - 1;
if (scroll.flags & VSCROLLBAR_VISIBLE)
- size -= 11;
- size = std::max(0, scroll.contentWidth - size);
- scroll.contentOffsetX = std::min(std::max(0, scroll.contentOffsetX + wheel), size);
- }
-
- WidgetScrollUpdateThumbs(w, widgetIndex);
- WidgetInvalidate(w, widgetIndex);
-}
-
-/**
- *
- * rct2: 0x006E793B
- */
-static int32_t WindowWheelInput(WindowBase& w, int32_t wheel)
-{
- int32_t i = 0;
- for (Widget* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
- {
- if (widget->type != WindowWidgetType::Scroll)
- continue;
-
- // Originally always checked first scroll view, bug maybe?
- const auto& scroll = w.scrolls[i];
- if (scroll.flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE))
{
- WindowScrollWheelInput(w, i, wheel);
- return 1;
- }
- i++;
- }
-
- return 0;
-}
-
-/**
- *
- * rct2: 0x006E79FB
- */
-static void WindowViewportWheelInput(WindowBase& w, int32_t wheel)
-{
- if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))
- return;
-
- if (wheel < 0)
- Windows::WindowZoomIn(w, true);
- else if (wheel > 0)
- Windows::WindowZoomOut(w, true);
-}
-
-static bool isSpinnerGroup(WindowBase& w, WidgetIndex index, WindowWidgetType buttonType)
-{
- const auto& widgets = w.widgets;
-
- if (widgets[index].type != WindowWidgetType::Spinner && widgets[index].type != WindowWidgetType::ImgBtn)
- return false;
-
- if (widgets[index + 1].type != buttonType)
- return false;
-
- if (widgets[index + 2].type != buttonType)
- return false;
-
- return true;
-}
-
-static std::optional getSpinnerGroupWidgetIndex(WindowBase& w, WidgetIndex startIndex)
-{
- // We only iterate 3 times as we might be at the spinner or one of its buttons.
- for (WidgetIndex index = 0; index < 3; index++)
- {
- const auto reverseIndex = startIndex - index;
- if (reverseIndex < 0)
- {
- break;
- }
-
- if (isSpinnerGroup(w, reverseIndex, WindowWidgetType::TrnBtn))
- {
- return reverseIndex;
- }
-
- if (isSpinnerGroup(w, reverseIndex, WindowWidgetType::Button))
- {
- return reverseIndex;
- }
- }
-
- return std::nullopt;
-}
-
-// Allow mouse wheel scrolling to manipulate spinner widgets and tool sizes
-static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_t wheel)
-{
- // HACK: Until we have a new window system that allows us to add new events like mouse wheel easily,
- // this selective approach will have to do.
-
- const auto spinnerGroupIndex = getSpinnerGroupWidgetIndex(w, widgetIndex);
- if (!spinnerGroupIndex.has_value())
- {
- return false;
- }
-
- const auto entryWidgetType = w.widgets[*spinnerGroupIndex].type;
- auto targetWidgetIndex = *spinnerGroupIndex;
-
- if (entryWidgetType == WindowWidgetType::ImgBtn)
- {
- auto expectedContent1 = ImageId(SPR_LAND_TOOL_DECREASE, FilterPaletteID::PaletteNull);
- auto expectedContent2 = ImageId(SPR_LAND_TOOL_INCREASE, FilterPaletteID::PaletteNull);
-
- auto button1Image = w.widgets[*spinnerGroupIndex + 1].image;
- auto button2Image = w.widgets[*spinnerGroupIndex + 2].image;
- if (button1Image != expectedContent1 || button2Image != expectedContent2)
- {
- return false;
- }
-
- // Expected widget order: decrease, increase
- targetWidgetIndex += wheel < 0 ? 2 : 1;
- }
- else if (entryWidgetType == WindowWidgetType::Spinner)
- {
- auto button1StringId = w.widgets[*spinnerGroupIndex + 1].text;
- auto button2StringId = w.widgets[*spinnerGroupIndex + 2].text;
- if (button1StringId != STR_NUMERIC_UP || button2StringId != STR_NUMERIC_DOWN)
- {
- return false;
- }
-
- // Expected widget order: increase, decrease
- targetWidgetIndex += wheel < 0 ? 1 : 2;
- }
-
- if (WidgetIsDisabled(w, targetWidgetIndex))
- {
- return false;
- }
-
- w.OnMouseDown(targetWidgetIndex);
- return true;
-}
-
-/**
- *
- * rct2: 0x006E7868
- */
-void WindowAllWheelInput()
-{
- // Get wheel value
- auto cursorState = ContextGetCursorState();
- int32_t absolute_wheel = cursorState->wheel;
- int32_t relative_wheel = absolute_wheel - _previousAbsoluteWheel;
- int32_t pixel_scroll = relative_wheel * WindowScrollPixels;
- _previousAbsoluteWheel = absolute_wheel;
-
- if (relative_wheel == 0)
- return;
-
- // Check window cursor is over
- if (!(InputTestFlag(INPUT_FLAG_5)))
- {
- WindowBase* w = WindowFindFromPoint(cursorState->position);
- if (w != nullptr)
- {
- // Check if main window
- if (w->classification == WindowClass::MainWindow || w->classification == WindowClass::Viewport)
- {
- WindowViewportWheelInput(*w, relative_wheel);
- return;
- }
-
- // Check scroll view, cursor is over
- WidgetIndex widgetIndex = WindowFindWidgetFromPoint(*w, cursorState->position);
- if (widgetIndex != -1)
- {
- const auto& widget = w->widgets[widgetIndex];
- if (widget.type == WindowWidgetType::Scroll)
- {
- int32_t scrollIndex = WindowGetScrollIndex(*w, widgetIndex);
- const auto& scroll = w->scrolls[scrollIndex];
- if (scroll.flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE))
- {
- WindowScrollWheelInput(*w, WindowGetScrollIndex(*w, widgetIndex), pixel_scroll);
- return;
- }
- }
- else
- {
- if (WindowOtherWheelInput(*w, widgetIndex, pixel_scroll))
- {
- return;
- }
- }
-
- // Check other scroll views on window
- if (WindowWheelInput(*w, pixel_scroll))
- return;
- }
- }
- }
-}
-
-void ApplyScreenSaverLockSetting()
-{
- Config::Get().general.DisableScreensaver ? SDL_DisableScreenSaver() : SDL_EnableScreenSaver();
-}
-
-/**
- *
- * rct2: 0x006EA776
- */
-static void WindowInvalidatePressedImageButton(const WindowBase& w)
-{
- WidgetIndex widgetIndex;
- Widget* widget;
-
- widgetIndex = 0;
- for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++, widgetIndex++)
- {
- if (widget->type != WindowWidgetType::ImgBtn)
- continue;
-
- if (WidgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex))
- GfxSetDirtyBlocks({ w.windowPos, w.windowPos + ScreenCoordsXY{ w.width, w.height } });
- }
-}
-
-void Window::ScrollToViewport()
-{
- if (viewport == nullptr || !focus.has_value())
- return;
-
- CoordsXYZ newCoords = focus.value().GetPos();
-
- auto mainWindow = WindowGetMain();
- if (mainWindow != nullptr)
- WindowScrollToLocation(*mainWindow, newCoords);
-}
-
-void Window::OnDraw(DrawPixelInfo& dpi)
-{
- Windows::WindowDrawWidgets(*this, dpi);
-}
-
-void Window::OnDrawWidget(WidgetIndex widgetIndex, DrawPixelInfo& dpi)
-{
- WidgetDraw(dpi, *this, widgetIndex);
-}
-
-void Window::InitScrollWidgets()
-{
- Windows::WindowInitScrollWidgets(*this);
-}
-
-void Window::InvalidateWidget(WidgetIndex widgetIndex)
-{
- WidgetInvalidate(*this, widgetIndex);
-}
-
-bool Window::IsWidgetDisabled(WidgetIndex widgetIndex) const
-{
- return WidgetIsDisabled(*this, widgetIndex);
-}
-
-bool Window::IsWidgetPressed(WidgetIndex widgetIndex) const
-{
- return WidgetIsPressed(*this, widgetIndex);
-}
-
-void Window::SetWidgetEnabled(WidgetIndex widgetIndex, bool value)
-{
- WidgetSetEnabled(*this, widgetIndex, value);
-}
-
-void Window::SetWidgetDisabled(WidgetIndex widgetIndex, bool value)
-{
- WidgetSetDisabled(*this, widgetIndex, value);
-}
-
-void Window::SetWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value)
-{
- bool oldState = IsWidgetDisabled(widgetIndex);
- if (oldState != value)
- {
- WidgetSetDisabled(*this, widgetIndex, value);
- InvalidateWidget(widgetIndex);
- }
-}
-
-void Window::SetWidgetPressed(WidgetIndex widgetIndex, bool value)
-{
- WidgetSetPressed(*this, widgetIndex, value);
-}
-
-void Window::SetCheckboxValue(WidgetIndex widgetIndex, bool value)
-{
- SetWidgetPressed(widgetIndex, value);
-}
-
-void Window::DrawWidgets(DrawPixelInfo& dpi)
-{
- Windows::WindowDrawWidgets(*this, dpi);
-}
-
-void Window::Close()
-{
- CloseWindowModifier modifier = GetCloseModifier();
-
- if (modifier == CloseWindowModifier::Shift)
- {
- CloseOthers();
- }
- else if (modifier == CloseWindowModifier::Control)
- {
- CloseOthersOfThisClass();
- }
- else
- {
- WindowClose(*this);
- }
-}
-
-void Window::CloseOthers()
-{
- WindowCloseAllExceptNumberAndClass(number, classification);
-}
-
-void Window::CloseOthersOfThisClass()
-{
- WindowCloseByClass(classification);
-}
-
-CloseWindowModifier Window::GetCloseModifier()
-{
- CloseWindowModifier lastModifier = CloseWindowModifier::None;
-
- if (gLastCloseModifier.window.number == number && gLastCloseModifier.window.classification == classification)
- {
- lastModifier = gLastCloseModifier.modifier;
- }
-
- gLastCloseModifier.modifier = CloseWindowModifier::None;
-
- return lastModifier;
-}
-
-void Window::TextInputOpen(
- WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existingText,
- uintptr_t existingArgs, int32_t maxLength)
-{
- OpenRCT2::Ui::Windows::WindowTextInputOpen(
- this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength);
-}
-
-void Window::ResizeFrame()
-{
- // Frame
- widgets[0].right = width - 1;
- widgets[0].bottom = height - 1;
- // Title
- widgets[1].right = width - 2;
- // Close button
- if (Config::Get().interface.WindowButtonsOnTheLeft)
- {
- widgets[2].left = 2;
- widgets[2].right = 2 + kCloseButtonWidth;
- }
- else
- {
- widgets[2].left = width - 3 - kCloseButtonWidth;
- widgets[2].right = width - 3;
- }
-}
-
-void Window::ResizeFrameWithPage()
-{
- ResizeFrame();
- // Page background
- widgets[3].right = width - 1;
- widgets[3].bottom = height - 1;
-}
-
-void Window::ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size)
-{
- auto right = origin.x + size.width - 1;
- auto bottom = origin.y + size.height - 1;
- widgets[widgetIndex].left = origin.x;
- widgets[widgetIndex].top = origin.y;
- widgets[widgetIndex].right = right;
- widgets[widgetIndex].bottom = bottom;
-
- widgets[widgetIndex + 1].left = right - size.height; // subtract height to maintain aspect ratio
- widgets[widgetIndex + 1].top = origin.y + 1;
- widgets[widgetIndex + 1].right = right - 1;
- widgets[widgetIndex + 1].bottom = bottom - 1;
-
- widgets[widgetIndex + 2].left = right - size.height * 2;
- widgets[widgetIndex + 2].top = origin.y + 1;
- widgets[widgetIndex + 2].right = right - size.height - 1;
- widgets[widgetIndex + 2].bottom = bottom - 1;
-}
-
-void Window::ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size)
-{
- auto right = origin.x + size.width - 1;
- auto bottom = origin.y + size.height - 1;
- widgets[widgetIndex].left = origin.x;
- widgets[widgetIndex].top = origin.y;
- widgets[widgetIndex].right = right;
- widgets[widgetIndex].bottom = bottom;
-
- widgets[widgetIndex + 1].left = right - size.height + 1; // subtract height to maintain aspect ratio
- widgets[widgetIndex + 1].top = origin.y + 1;
- widgets[widgetIndex + 1].right = right - 1;
- widgets[widgetIndex + 1].bottom = bottom - 1;
-}
-
-void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_tab_id)
-{
- int32_t i, x = w->widgets[start_tab_id].left;
- int32_t tab_width = w->widgets[start_tab_id].width();
-
- for (i = start_tab_id; i <= end_tab_id; i++)
- {
- auto& widget = w->widgets[i];
- if (!WidgetIsDisabled(*w, i))
- {
- widget.left = x;
- widget.right = x + tab_width;
- x += tab_width + 1;
+ int32_t size = widget->height() - 1;
+ if (scroll.flags & HSCROLLBAR_VISIBLE)
+ size -= 11;
+ size = std::max(0, scroll.contentHeight - size);
+ scroll.contentOffsetY = std::min(std::max(0, scroll.contentOffsetY + wheel), size);
}
else
{
- // Workaround #20535: Avoid disabled widgets from sharing the same space as active ones, otherwise
- // WindowFindWidgetFromPoint could return the disabled one, causing issues.
- widget.left = 0;
- widget.right = 0;
+ int32_t size = widget->width() - 1;
+ if (scroll.flags & VSCROLLBAR_VISIBLE)
+ size -= 11;
+ size = std::max(0, scroll.contentWidth - size);
+ scroll.contentOffsetX = std::min(std::max(0, scroll.contentOffsetX + wheel), size);
+ }
+
+ WidgetScrollUpdateThumbs(w, widgetIndex);
+
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateWidget(w, widgetIndex);
+ }
+
+ /**
+ *
+ * rct2: 0x006E793B
+ */
+ static int32_t WindowWheelInput(WindowBase& w, int32_t wheel)
+ {
+ int32_t scrollIndex = 0;
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
+ {
+ const auto& widget = w.widgets[widgetIndex];
+ if (widget.type != WindowWidgetType::Scroll)
+ continue;
+
+ // Originally always checked first scroll view, bug maybe?
+ const auto& scroll = w.scrolls[scrollIndex];
+ if (scroll.flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE))
+ {
+ WindowScrollWheelInput(w, scrollIndex, wheel);
+ return 1;
+ }
+ scrollIndex++;
+ }
+
+ return 0;
+ }
+
+ /**
+ *
+ * rct2: 0x006E79FB
+ */
+ static void WindowViewportWheelInput(WindowBase& w, int32_t wheel)
+ {
+ if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))
+ return;
+
+ if (wheel < 0)
+ Windows::WindowZoomIn(w, true);
+ else if (wheel > 0)
+ Windows::WindowZoomOut(w, true);
+ }
+
+ static bool isSpinnerGroup(WindowBase& w, WidgetIndex index, WindowWidgetType buttonType)
+ {
+ const auto& widgets = w.widgets;
+
+ if (widgets[index].type != WindowWidgetType::Spinner && widgets[index].type != WindowWidgetType::ImgBtn)
+ return false;
+
+ if (static_cast(index + 2) >= widgets.size())
+ return false;
+
+ if (widgets[index + 1].type != buttonType)
+ return false;
+
+ if (widgets[index + 2].type != buttonType)
+ return false;
+
+ return true;
+ }
+
+ static std::optional getSpinnerGroupWidgetIndex(WindowBase& w, WidgetIndex startIndex)
+ {
+ // We only iterate 3 times as we might be at the spinner or one of its buttons.
+ for (WidgetIndex index = 0; index < 3; index++)
+ {
+ const auto reverseIndex = startIndex - index;
+ if (reverseIndex < 0)
+ {
+ break;
+ }
+
+ if (isSpinnerGroup(w, reverseIndex, WindowWidgetType::TrnBtn))
+ {
+ return reverseIndex;
+ }
+
+ if (isSpinnerGroup(w, reverseIndex, WindowWidgetType::Button))
+ {
+ return reverseIndex;
+ }
+ }
+
+ return std::nullopt;
+ }
+
+ // Allow mouse wheel scrolling to manipulate spinner widgets and tool sizes
+ static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_t wheel)
+ {
+ // HACK: Until we have a new window system that allows us to add new events like mouse wheel easily,
+ // this selective approach will have to do.
+
+ const auto spinnerGroupIndex = getSpinnerGroupWidgetIndex(w, widgetIndex);
+ if (!spinnerGroupIndex.has_value())
+ {
+ return false;
+ }
+
+ const auto entryWidgetType = w.widgets[*spinnerGroupIndex].type;
+ auto targetWidgetIndex = *spinnerGroupIndex;
+
+ if (entryWidgetType == WindowWidgetType::ImgBtn)
+ {
+ auto expectedContent1 = ImageId(SPR_LAND_TOOL_DECREASE, FilterPaletteID::PaletteNull);
+ auto expectedContent2 = ImageId(SPR_LAND_TOOL_INCREASE, FilterPaletteID::PaletteNull);
+
+ auto button1Image = w.widgets[*spinnerGroupIndex + 1].image;
+ auto button2Image = w.widgets[*spinnerGroupIndex + 2].image;
+ if (button1Image != expectedContent1 || button2Image != expectedContent2)
+ {
+ return false;
+ }
+
+ // Expected widget order: decrease, increase
+ targetWidgetIndex += wheel < 0 ? 2 : 1;
+ }
+ else if (entryWidgetType == WindowWidgetType::Spinner)
+ {
+ auto button1StringId = w.widgets[*spinnerGroupIndex + 1].text;
+ auto button2StringId = w.widgets[*spinnerGroupIndex + 2].text;
+ if (button1StringId != STR_NUMERIC_UP || button2StringId != STR_NUMERIC_DOWN)
+ {
+ return false;
+ }
+
+ // Expected widget order: increase, decrease
+ targetWidgetIndex += wheel < 0 ? 1 : 2;
+ }
+
+ assert(targetWidgetIndex >= 0 && targetWidgetIndex < w.widgets.size());
+
+ if (WidgetIsDisabled(w, targetWidgetIndex))
+ {
+ return false;
+ }
+
+ w.OnMouseDown(targetWidgetIndex);
+ return true;
+ }
+
+ /**
+ *
+ * rct2: 0x006E7868
+ */
+ void WindowAllWheelInput()
+ {
+ // Get wheel value
+ auto cursorState = ContextGetCursorState();
+ int32_t absolute_wheel = cursorState->wheel;
+ int32_t relative_wheel = absolute_wheel - _previousAbsoluteWheel;
+ int32_t pixel_scroll = relative_wheel * kWindowScrollPixels;
+ _previousAbsoluteWheel = absolute_wheel;
+
+ if (relative_wheel == 0)
+ return;
+
+ // Check window cursor is over
+ if (!(InputTestFlag(INPUT_FLAG_5)))
+ {
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindFromPoint(cursorState->position);
+ if (w != nullptr)
+ {
+ // Check if main window
+ if (w->classification == WindowClass::MainWindow || w->classification == WindowClass::Viewport)
+ {
+ WindowViewportWheelInput(*w, relative_wheel);
+ return;
+ }
+
+ // Check scroll view, cursor is over
+ WidgetIndex widgetIndex = windowMgr->FindWidgetFromPoint(*w, cursorState->position);
+ if (widgetIndex != kWidgetIndexNull)
+ {
+ const auto& widget = w->widgets[widgetIndex];
+ if (widget.type == WindowWidgetType::Scroll)
+ {
+ int32_t scrollIndex = WindowGetScrollIndex(*w, widgetIndex);
+ const auto& scroll = w->scrolls[scrollIndex];
+ if (scroll.flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE))
+ {
+ WindowScrollWheelInput(*w, WindowGetScrollIndex(*w, widgetIndex), pixel_scroll);
+ return;
+ }
+ }
+ else
+ {
+ if (WindowOtherWheelInput(*w, widgetIndex, pixel_scroll))
+ {
+ return;
+ }
+ }
+
+ // Check other scroll views on window
+ if (WindowWheelInput(*w, pixel_scroll))
+ return;
+ }
+ }
}
}
-}
-ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w)
-{
- const uint8_t buttonOffset = (Config::Get().interface.WindowButtonsOnTheLeft) ? kCloseButtonWidth + 2 : 0;
- return w.windowPos + ScreenCoordsXY{ 2 + buttonOffset, 2 };
-}
+ void ApplyScreenSaverLockSetting()
+ {
+ Config::Get().general.DisableScreensaver ? SDL_DisableScreenSaver() : SDL_EnableScreenSaver();
+ }
+
+ /**
+ *
+ * rct2: 0x006EA776
+ */
+ static void WindowInvalidatePressedImageButton(const WindowBase& w)
+ {
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
+ {
+ auto& widget = w.widgets[widgetIndex];
+ if (widget.type != WindowWidgetType::ImgBtn)
+ continue;
+
+ if (WidgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex))
+ GfxSetDirtyBlocks({ w.windowPos, w.windowPos + ScreenCoordsXY{ w.width, w.height } });
+ }
+ }
+
+ void Window::ScrollToViewport()
+ {
+ if (viewport == nullptr || !focus.has_value())
+ return;
+
+ CoordsXYZ newCoords = focus.value().GetPos();
+
+ auto mainWindow = WindowGetMain();
+ if (mainWindow != nullptr)
+ WindowScrollToLocation(*mainWindow, newCoords);
+ }
+
+ void Window::OnDraw(DrawPixelInfo& dpi)
+ {
+ Windows::WindowDrawWidgets(*this, dpi);
+ }
+
+ void Window::OnDrawWidget(WidgetIndex widgetIndex, DrawPixelInfo& dpi)
+ {
+ WidgetDraw(dpi, *this, widgetIndex);
+ }
+
+ void Window::InitScrollWidgets()
+ {
+ Windows::WindowInitScrollWidgets(*this);
+ }
+
+ void Window::InvalidateWidget(WidgetIndex widgetIndex)
+ {
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateWidget(*this, widgetIndex);
+ }
+
+ bool Window::IsWidgetDisabled(WidgetIndex widgetIndex) const
+ {
+ return WidgetIsDisabled(*this, widgetIndex);
+ }
+
+ bool Window::IsWidgetPressed(WidgetIndex widgetIndex) const
+ {
+ return WidgetIsPressed(*this, widgetIndex);
+ }
+
+ void Window::SetWidgetEnabled(WidgetIndex widgetIndex, bool value)
+ {
+ WidgetSetEnabled(*this, widgetIndex, value);
+ }
+
+ void Window::SetWidgetDisabled(WidgetIndex widgetIndex, bool value)
+ {
+ WidgetSetDisabled(*this, widgetIndex, value);
+ }
+
+ void Window::SetWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value)
+ {
+ bool oldState = IsWidgetDisabled(widgetIndex);
+ if (oldState != value)
+ {
+ WidgetSetDisabled(*this, widgetIndex, value);
+ InvalidateWidget(widgetIndex);
+ }
+ }
+
+ void Window::SetWidgetPressed(WidgetIndex widgetIndex, bool value)
+ {
+ WidgetSetPressed(*this, widgetIndex, value);
+ }
+
+ void Window::SetCheckboxValue(WidgetIndex widgetIndex, bool value)
+ {
+ SetWidgetPressed(widgetIndex, value);
+ }
+
+ void Window::DrawWidgets(DrawPixelInfo& dpi)
+ {
+ Windows::WindowDrawWidgets(*this, dpi);
+ }
+
+ void Window::Close()
+ {
+ CloseWindowModifier modifier = GetCloseModifier();
+
+ if (modifier == CloseWindowModifier::Shift)
+ {
+ CloseOthers();
+ }
+ else if (modifier == CloseWindowModifier::Control)
+ {
+ CloseOthersOfThisClass();
+ }
+ else
+ {
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->Close(*this);
+ }
+ }
+
+ void Window::CloseOthers()
+ {
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAllExceptNumberAndClass(number, classification);
+ }
+
+ void Window::CloseOthersOfThisClass()
+ {
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseByClass(classification);
+ }
+
+ CloseWindowModifier Window::GetCloseModifier()
+ {
+ CloseWindowModifier lastModifier = CloseWindowModifier::None;
+
+ if (gLastCloseModifier.window.number == number && gLastCloseModifier.window.classification == classification)
+ {
+ lastModifier = gLastCloseModifier.modifier;
+ }
+
+ gLastCloseModifier.modifier = CloseWindowModifier::None;
+
+ return lastModifier;
+ }
+
+ void Window::TextInputOpen(
+ WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existingText,
+ uintptr_t existingArgs, int32_t maxLength)
+ {
+ OpenRCT2::Ui::Windows::WindowTextInputOpen(
+ this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength);
+ }
+
+ void Window::ResizeFrame()
+ {
+ // Frame
+ widgets[0].right = width - 1;
+ widgets[0].bottom = height - 1;
+ // Title
+ widgets[1].right = width - 2;
+ // Close button
+ if (Config::Get().interface.WindowButtonsOnTheLeft)
+ {
+ widgets[2].left = 2;
+ widgets[2].right = 2 + kCloseButtonWidth;
+ }
+ else
+ {
+ widgets[2].left = width - 3 - kCloseButtonWidth;
+ widgets[2].right = width - 3;
+ }
+ }
+
+ void Window::ResizeFrameWithPage()
+ {
+ ResizeFrame();
+ // Page background
+ widgets[3].right = width - 1;
+ widgets[3].bottom = height - 1;
+ }
+
+ void Window::ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size)
+ {
+ auto right = origin.x + size.width - 1;
+ auto bottom = origin.y + size.height - 1;
+ widgets[widgetIndex].left = origin.x;
+ widgets[widgetIndex].top = origin.y;
+ widgets[widgetIndex].right = right;
+ widgets[widgetIndex].bottom = bottom;
+
+ widgets[widgetIndex + 1].left = right - size.height; // subtract height to maintain aspect ratio
+ widgets[widgetIndex + 1].top = origin.y + 1;
+ widgets[widgetIndex + 1].right = right - 1;
+ widgets[widgetIndex + 1].bottom = bottom - 1;
+
+ widgets[widgetIndex + 2].left = right - size.height * 2;
+ widgets[widgetIndex + 2].top = origin.y + 1;
+ widgets[widgetIndex + 2].right = right - size.height - 1;
+ widgets[widgetIndex + 2].bottom = bottom - 1;
+ }
+
+ void Window::ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size)
+ {
+ auto right = origin.x + size.width - 1;
+ auto bottom = origin.y + size.height - 1;
+ widgets[widgetIndex].left = origin.x;
+ widgets[widgetIndex].top = origin.y;
+ widgets[widgetIndex].right = right;
+ widgets[widgetIndex].bottom = bottom;
+
+ widgets[widgetIndex + 1].left = right - size.height + 1; // subtract height to maintain aspect ratio
+ widgets[widgetIndex + 1].top = origin.y + 1;
+ widgets[widgetIndex + 1].right = right - 1;
+ widgets[widgetIndex + 1].bottom = bottom - 1;
+ }
+
+ void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_tab_id)
+ {
+ assert(start_tab_id < w->widgets.size());
+ assert(end_tab_id < w->widgets.size());
+
+ int32_t i, x = w->widgets[start_tab_id].left;
+ int32_t tab_width = w->widgets[start_tab_id].width();
+
+ for (i = start_tab_id; i <= end_tab_id; i++)
+ {
+ auto& widget = w->widgets[i];
+ assert(widget.type == WindowWidgetType::Tab);
+
+ if (!WidgetIsDisabled(*w, i))
+ {
+ widget.left = x;
+ widget.right = x + tab_width;
+ x += tab_width + 1;
+ }
+ else
+ {
+ // Workaround #20535: Avoid disabled widgets from sharing the same space as active ones, otherwise
+ // WindowFindWidgetFromPoint could return the disabled one, causing issues.
+ widget.left = 0;
+ widget.right = 0;
+ }
+ }
+ }
+
+ ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w)
+ {
+ const uint8_t buttonOffset = (Config::Get().interface.WindowButtonsOnTheLeft) ? kCloseButtonWidth + 2 : 0;
+ return w.windowPos + ScreenCoordsXY{ 2 + buttonOffset, 2 };
+ }
+} // namespace OpenRCT2
namespace OpenRCT2::Ui::Windows
{
@@ -730,96 +576,6 @@ namespace OpenRCT2::Ui::Windows
static TextInputSession* _textInput;
static WidgetIdentifier _currentTextBox = { { WindowClass::Null, 0 }, 0 };
- WindowBase* WindowCreate(
- std::unique_ptr&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags)
- {
- if (flags & WF_AUTO_POSITION)
- {
- if (flags & WF_CENTRE_SCREEN)
- {
- pos = GetCentrePositionForNewWindow(width, height);
- }
- else
- {
- pos = GetAutoPositionForNewWindow(width, height);
- }
- }
-
- // Check if there are any window slots left
- // include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
- if (g_window_list.size() >= static_cast(Config::Get().general.WindowLimit + kWindowLimitReserved))
- {
- // Close least recently used window
- for (auto& w : g_window_list)
- {
- if (w->flags & WF_DEAD)
- continue;
- if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
- {
- WindowClose(*w.get());
- break;
- }
- }
- }
-
- // Find right position to insert new window
- auto itDestPos = g_window_list.end();
- if (flags & WF_STICK_TO_BACK)
- {
- for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
- {
- if ((*it)->flags & WF_DEAD)
- continue;
- if (!((*it)->flags & WF_STICK_TO_BACK))
- {
- itDestPos = it;
- }
- }
- }
- else if (!(flags & WF_STICK_TO_FRONT))
- {
- for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
- {
- if ((*it)->flags & WF_DEAD)
- continue;
- if (!((*it)->flags & WF_STICK_TO_FRONT))
- {
- itDestPos = it.base();
- break;
- }
- }
- }
-
- auto itNew = g_window_list.insert(itDestPos, std::move(wp));
- auto w = itNew->get();
-
- // Setup window
- w->classification = cls;
- w->flags = flags;
-
- // Play sounds and flash the window
- if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
- {
- w->flags |= WF_WHITE_BORDER_MASK;
- OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
- }
-
- w->windowPos = pos;
- w->width = width;
- w->height = height;
- w->min_width = width;
- w->max_width = width;
- w->min_height = height;
- w->max_height = height;
-
- w->focus = std::nullopt;
-
- ColourSchemeUpdate(w);
- w->Invalidate();
- w->OnOpen();
- return w;
- }
-
WindowBase* WindowGetListening()
{
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
@@ -856,7 +612,8 @@ namespace OpenRCT2::Ui::Windows
_currentTextBox.widget_index = callWidget;
_textBoxFrameNo = 0;
- WindowCloseByClass(WindowClass::Textinput);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::Textinput);
_textBoxInput = existingText;
@@ -867,16 +624,17 @@ namespace OpenRCT2::Ui::Windows
{
if (_usingWidgetTextBox)
{
- WindowBase* w = WindowFindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
_currentTextBox.window.classification = WindowClass::Null;
_currentTextBox.window.number = 0;
ContextStopTextInput();
_usingWidgetTextBox = false;
if (w != nullptr)
{
- WidgetInvalidate(*w, _currentTextBox.widget_index);
+ windowMgr->InvalidateWidget(*w, _currentTextBox.widget_index);
}
- _currentTextBox.widget_index = static_cast(WindowWidgetType::Last);
+ _currentTextBox.widget_index = kWidgetIndexNull;
}
}
@@ -892,8 +650,9 @@ namespace OpenRCT2::Ui::Windows
if (_usingWidgetTextBox)
{
_textBoxFrameNo = 0;
- WindowBase* w = WindowFindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
- WidgetInvalidate(*w, _currentTextBox.widget_index);
+ auto* windowMgr = GetWindowManager();
+ WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
+ windowMgr->InvalidateWidget(*w, _currentTextBox.widget_index);
w->OnTextInput(_currentTextBox.widget_index, _textBoxInput);
}
}
@@ -954,14 +713,11 @@ namespace OpenRCT2::Ui::Windows
void WindowUpdateScrollWidgets(WindowBase& w)
{
int32_t scrollIndex, width, height, scrollPositionChanged;
- WidgetIndex widgetIndex;
- Widget* widget;
-
- widgetIndex = 0;
scrollIndex = 0;
- for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++, widgetIndex++)
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
{
- if (widget->type != WindowWidgetType::Scroll)
+ auto& widget = w.widgets[widgetIndex];
+ if (widget.type != WindowWidgetType::Scroll)
continue;
auto& scroll = w.scrolls[scrollIndex];
@@ -981,13 +737,13 @@ namespace OpenRCT2::Ui::Windows
height++;
scrollPositionChanged = 0;
- if ((widget->content & SCROLL_HORIZONTAL) && width != scroll.contentWidth)
+ if ((widget.content & SCROLL_HORIZONTAL) && width != scroll.contentWidth)
{
scrollPositionChanged = 1;
scroll.contentWidth = width;
}
- if ((widget->content & SCROLL_VERTICAL) && height != scroll.contentHeight)
+ if ((widget.content & SCROLL_VERTICAL) && height != scroll.contentHeight)
{
scrollPositionChanged = 1;
scroll.contentHeight = height;
@@ -1007,16 +763,12 @@ namespace OpenRCT2::Ui::Windows
*/
void WindowInitScrollWidgets(WindowBase& w)
{
- Widget* widget;
- int32_t widget_index, scroll_index;
-
- widget_index = 0;
- scroll_index = 0;
- for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
+ int32_t scroll_index{};
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
{
- if (widget->type != WindowWidgetType::Scroll)
+ auto& widget = w.widgets[widgetIndex];
+ if (widget.type != WindowWidgetType::Scroll)
{
- widget_index++;
continue;
}
@@ -1028,14 +780,12 @@ namespace OpenRCT2::Ui::Windows
scroll.contentOffsetY = 0;
scroll.contentHeight = scrollSize.height + 1;
- if (widget->content & SCROLL_HORIZONTAL)
+ if (widget.content & SCROLL_HORIZONTAL)
scroll.flags |= HSCROLLBAR_VISIBLE;
- if (widget->content & SCROLL_VERTICAL)
+ if (widget.content & SCROLL_VERTICAL)
scroll.flags |= VSCROLLBAR_VISIBLE;
- WidgetScrollUpdateThumbs(w, widget_index);
-
- widget_index++;
+ WidgetScrollUpdateThumbs(w, widgetIndex);
scroll_index++;
}
}
@@ -1308,30 +1058,27 @@ namespace OpenRCT2::Ui::Windows
*/
void WindowDrawWidgets(WindowBase& w, DrawPixelInfo& dpi)
{
- Widget* widget;
- WidgetIndex widgetIndex;
-
if ((w.flags & WF_TRANSPARENT) && !(w.flags & WF_NO_BACKGROUND))
GfxFilterRect(
dpi, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, FilterPaletteID::Palette51);
// todo: some code missing here? Between 006EB18C and 006EB260
-
- widgetIndex = 0;
- for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
{
- if (widget->IsVisible())
+ auto& widget = w.widgets[widgetIndex];
+ if (!widget.IsVisible())
{
- // Check if widget is outside the draw region
- if (w.windowPos.x + widget->left < dpi.x + dpi.width && w.windowPos.x + widget->right >= dpi.x)
+ continue;
+ }
+
+ // Check if widget is outside the draw region
+ if (w.windowPos.x + widget.left < dpi.x + dpi.width && w.windowPos.x + widget.right >= dpi.x)
+ {
+ if (w.windowPos.y + widget.top < dpi.y + dpi.height && w.windowPos.y + widget.bottom >= dpi.y)
{
- if (w.windowPos.y + widget->top < dpi.y + dpi.height && w.windowPos.y + widget->bottom >= dpi.y)
- {
- w.OnDrawWidget(widgetIndex, dpi);
- }
+ w.OnDrawWidget(widgetIndex, dpi);
}
}
- widgetIndex++;
}
// todo: something missing here too? Between 006EC32B and 006EC369
diff --git a/src/openrct2-ui/interface/Window.h b/src/openrct2-ui/interface/Window.h
index 6b2000da8c..a05dc8acd7 100644
--- a/src/openrct2-ui/interface/Window.h
+++ b/src/openrct2-ui/interface/Window.h
@@ -14,106 +14,47 @@
struct TextInputSession;
-struct Window : WindowBase
+namespace OpenRCT2
{
- virtual void OnDraw(DrawPixelInfo& dpi) override;
- virtual void OnDrawWidget(WidgetIndex widgetIndex, DrawPixelInfo& dpi) override;
+ struct Window : WindowBase
+ {
+ void OnDraw(DrawPixelInfo& dpi) override;
+ void OnDrawWidget(WidgetIndex widgetIndex, DrawPixelInfo& dpi) override;
- void ScrollToViewport();
- void InitScrollWidgets();
- void InvalidateWidget(WidgetIndex widgetIndex);
- bool IsWidgetDisabled(WidgetIndex widgetIndex) const;
- bool IsWidgetPressed(WidgetIndex widgetIndex) const;
- void SetWidgetEnabled(WidgetIndex widgetIndex, bool value);
- void SetWidgetDisabled(WidgetIndex widgetIndex, bool value);
- void SetWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value);
- void SetWidgetPressed(WidgetIndex widgetIndex, bool value);
- void SetCheckboxValue(WidgetIndex widgetIndex, bool value);
- void DrawWidgets(DrawPixelInfo& dpi);
- void Close();
- void CloseOthers();
- void CloseOthersOfThisClass();
- CloseWindowModifier GetCloseModifier();
- void TextInputOpen(
- WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existingText,
- uintptr_t existingArgs, int32_t maxLength);
+ void ScrollToViewport();
+ void InitScrollWidgets();
+ void InvalidateWidget(WidgetIndex widgetIndex);
+ bool IsWidgetDisabled(WidgetIndex widgetIndex) const;
+ bool IsWidgetPressed(WidgetIndex widgetIndex) const;
+ void SetWidgetEnabled(WidgetIndex widgetIndex, bool value);
+ void SetWidgetDisabled(WidgetIndex widgetIndex, bool value);
+ void SetWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value);
+ void SetWidgetPressed(WidgetIndex widgetIndex, bool value);
+ void SetCheckboxValue(WidgetIndex widgetIndex, bool value);
+ void DrawWidgets(DrawPixelInfo& dpi);
+ void Close();
+ void CloseOthers();
+ void CloseOthersOfThisClass();
+ CloseWindowModifier GetCloseModifier();
+ void TextInputOpen(
+ WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs,
+ StringId existingText, uintptr_t existingArgs, int32_t maxLength);
- void ResizeFrame();
- void ResizeFrameWithPage();
+ void ResizeFrame();
+ void ResizeFrameWithPage();
- void ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
- void ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
-};
+ void ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
+ void ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
+ };
-void WindowAllWheelInput();
-void ApplyScreenSaverLockSetting();
-void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_tab_id);
-ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w);
+ void WindowAllWheelInput();
+ void ApplyScreenSaverLockSetting();
+ void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_tab_id);
+ ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w);
+} // namespace OpenRCT2
namespace OpenRCT2::Ui::Windows
{
- WindowBase* WindowCreate(
- std::unique_ptr&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags);
- template::value>::type* = nullptr>
- T* WindowCreate(
- WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0,
- TArgs&&... args)
- {
- return static_cast(WindowCreate(std::make_unique(std::forward(args)...), cls, pos, width, height, flags));
- }
- template::value>::type* = nullptr>
- T* WindowCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags, TArgs&&... args)
- {
- return static_cast(
- WindowCreate(std::make_unique(std::forward(args)...), cls, {}, width, height, flags | WF_AUTO_POSITION));
- }
- template::value>::type* = nullptr>
- T* WindowFocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0)
- {
- auto* w = WindowBringToFrontByClass(cls);
- if (w == nullptr)
- {
- w = WindowCreate(cls, pos, width, height, flags);
- }
- return static_cast(w);
- }
- template::value>::type* = nullptr>
- T* WindowFocusOrCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0)
- {
- auto* w = WindowBringToFrontByClass(cls);
- if (w == nullptr)
- {
- w = WindowCreate(cls, width, height, flags);
- }
- return static_cast(w);
- }
-
- 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();
diff --git a/src/openrct2-ui/libopenrct2ui.vcxproj b/src/openrct2-ui/libopenrct2ui.vcxproj
index ff830f6af9..7f0ebcde92 100644
--- a/src/openrct2-ui/libopenrct2ui.vcxproj
+++ b/src/openrct2-ui/libopenrct2ui.vcxproj
@@ -101,7 +101,7 @@
-
+
diff --git a/src/openrct2-ui/ride/Construction.cpp b/src/openrct2-ui/ride/Construction.cpp
index caf313fa01..40bda7c494 100644
--- a/src/openrct2-ui/ride/Construction.cpp
+++ b/src/openrct2-ui/ride/Construction.cpp
@@ -24,6 +24,200 @@ using namespace OpenRCT2::TrackMetaData;
namespace OpenRCT2
{
+ constexpr auto kSeparator = TrackElemType::None;
+
+ /**
+ * Order of special track elements dropdown. Elements with the same name string must be sequential or they show up twice.
+ */
+ constexpr std::array kSpecialElementsDropdownOrder = {
+ TrackElemType::EndStation,
+
+ // Brakes
+ TrackElemType::Brakes,
+ TrackElemType::DiagBrakes,
+ TrackElemType::Down25Brakes,
+ TrackElemType::BlockBrakes,
+ TrackElemType::DiagBlockBrakes,
+
+ // Boosters
+ TrackElemType::Booster,
+ TrackElemType::DiagBooster,
+
+ // Photo sections
+ TrackElemType::OnRidePhoto,
+
+ // Rotation control
+ TrackElemType::RotationControlToggle,
+
+ // (Curved) lift (hills) pieces
+ TrackElemType::LeftCurvedLiftHill,
+ TrackElemType::RightCurvedLiftHill,
+ TrackElemType::CableLiftHill,
+ TrackElemType::PoweredLift,
+ kSeparator,
+
+ // Heart Line pieces
+ TrackElemType::HeartLineTransferUp,
+ TrackElemType::HeartLineTransferDown,
+ TrackElemType::LeftHeartLineRoll,
+ TrackElemType::RightHeartLineRoll,
+ kSeparator,
+
+ // Brake for drop
+ TrackElemType::BrakeForDrop,
+ kSeparator,
+
+ // Tower
+ TrackElemType::TowerBase,
+ TrackElemType::TowerSection,
+ kSeparator,
+
+ // Mini Golf pieces
+ TrackElemType::MinigolfHoleA,
+ TrackElemType::MinigolfHoleB,
+ TrackElemType::MinigolfHoleC,
+ TrackElemType::MinigolfHoleD,
+ TrackElemType::MinigolfHoleE,
+ kSeparator,
+
+ // S-Bends
+ TrackElemType::SBendLeft,
+ TrackElemType::SBendRight,
+ kSeparator,
+
+ // Helixes
+ TrackElemType::LeftHalfBankedHelixUpSmall,
+ TrackElemType::RightHalfBankedHelixUpSmall,
+ TrackElemType::LeftHalfBankedHelixDownSmall,
+ TrackElemType::RightHalfBankedHelixDownSmall,
+ TrackElemType::LeftHalfBankedHelixUpLarge,
+ TrackElemType::RightHalfBankedHelixUpLarge,
+ TrackElemType::LeftHalfBankedHelixDownLarge,
+ TrackElemType::RightHalfBankedHelixDownLarge,
+ TrackElemType::LeftQuarterBankedHelixLargeUp,
+ TrackElemType::RightQuarterBankedHelixLargeUp,
+ TrackElemType::LeftQuarterBankedHelixLargeDown,
+ TrackElemType::RightQuarterBankedHelixLargeDown,
+ TrackElemType::LeftQuarterHelixLargeUp,
+ TrackElemType::RightQuarterHelixLargeUp,
+ TrackElemType::LeftQuarterHelixLargeDown,
+ TrackElemType::RightQuarterHelixLargeDown,
+ kSeparator,
+
+ // (Wooden) water splash
+ TrackElemType::Watersplash,
+ kSeparator,
+
+ // River Rapids
+ TrackElemType::Waterfall,
+ TrackElemType::Rapids, // Also used for Monster Trucks
+ TrackElemType::Whirlpool,
+ kSeparator,
+
+ // Spinning tunnel
+ TrackElemType::SpinningTunnel,
+ kSeparator,
+
+ // Reverser pieces
+ TrackElemType::LeftReverser,
+ TrackElemType::RightReverser,
+ TrackElemType::LogFlumeReverser,
+ kSeparator,
+
+ // Reverse freefall pieces
+ TrackElemType::ReverseFreefallSlope,
+ TrackElemType::ReverseFreefallVertical,
+
+ // Air thrust pieces
+ TrackElemType::AirThrustTopCap,
+ TrackElemType::AirThrustVerticalDown,
+ TrackElemType::AirThrustVerticalDownToLevel,
+ kSeparator,
+
+ // Corkscrews
+ TrackElemType::LeftCorkscrewUp,
+ TrackElemType::LeftCorkscrewDown,
+ TrackElemType::RightCorkscrewUp,
+ TrackElemType::RightCorkscrewDown,
+ TrackElemType::LeftFlyerCorkscrewUp,
+ TrackElemType::LeftFlyerCorkscrewDown,
+ TrackElemType::RightFlyerCorkscrewUp,
+ TrackElemType::RightFlyerCorkscrewDown,
+ TrackElemType::LeftLargeCorkscrewUp,
+ TrackElemType::LeftLargeCorkscrewDown,
+ TrackElemType::RightLargeCorkscrewUp,
+ TrackElemType::RightLargeCorkscrewDown,
+ kSeparator,
+
+ // Loops
+ TrackElemType::LeftVerticalLoop,
+ TrackElemType::RightVerticalLoop,
+ TrackElemType::HalfLoopUp,
+ TrackElemType::HalfLoopDown,
+ TrackElemType::FlyerHalfLoopUninvertedUp,
+ TrackElemType::FlyerHalfLoopInvertedDown,
+ TrackElemType::FlyerHalfLoopInvertedUp,
+ TrackElemType::FlyerHalfLoopUninvertedDown,
+ TrackElemType::LeftMediumHalfLoopUp,
+ TrackElemType::LeftMediumHalfLoopDown,
+ TrackElemType::RightMediumHalfLoopUp,
+ TrackElemType::RightMediumHalfLoopDown,
+ TrackElemType::LeftLargeHalfLoopUp,
+ TrackElemType::LeftLargeHalfLoopDown,
+ TrackElemType::RightLargeHalfLoopUp,
+ TrackElemType::RightLargeHalfLoopDown,
+ TrackElemType::LeftFlyerLargeHalfLoopUninvertedUp,
+ TrackElemType::LeftFlyerLargeHalfLoopInvertedDown,
+ TrackElemType::LeftFlyerLargeHalfLoopInvertedUp,
+ TrackElemType::LeftFlyerLargeHalfLoopUninvertedDown,
+ TrackElemType::RightFlyerLargeHalfLoopUninvertedUp,
+ TrackElemType::RightFlyerLargeHalfLoopInvertedDown,
+ TrackElemType::RightFlyerLargeHalfLoopInvertedUp,
+ TrackElemType::RightFlyerLargeHalfLoopUninvertedDown,
+ TrackElemType::MultiDimInvertedFlatToDown90QuarterLoop,
+ TrackElemType::Up90ToInvertedFlatQuarterLoop,
+ TrackElemType::InvertedFlatToDown90QuarterLoop,
+ TrackElemType::MultiDimUp90ToInvertedFlatQuarterLoop,
+ TrackElemType::MultiDimFlatToDown90QuarterLoop,
+ TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop,
+ kSeparator,
+
+ // Zero-G Rolls, Dive Loops
+ TrackElemType::LeftZeroGRollUp,
+ TrackElemType::LeftZeroGRollDown,
+ TrackElemType::RightZeroGRollUp,
+ TrackElemType::RightZeroGRollDown,
+ TrackElemType::LeftLargeZeroGRollUp,
+ TrackElemType::LeftLargeZeroGRollDown,
+ TrackElemType::RightLargeZeroGRollUp,
+ TrackElemType::RightLargeZeroGRollDown,
+ TrackElemType::LeftEighthDiveLoopUpToOrthogonal,
+ TrackElemType::LeftEighthDiveLoopDownToDiag,
+ TrackElemType::RightEighthDiveLoopUpToOrthogonal,
+ TrackElemType::RightEighthDiveLoopDownToDiag,
+ kSeparator,
+
+ // Barrel Rolls
+ TrackElemType::LeftBarrelRollUpToDown,
+ TrackElemType::LeftBarrelRollDownToUp,
+ TrackElemType::RightBarrelRollUpToDown,
+ TrackElemType::RightBarrelRollDownToUp,
+ kSeparator,
+
+ // Twists
+ TrackElemType::LeftTwistDownToUp,
+ TrackElemType::LeftTwistUpToDown,
+ TrackElemType::RightTwistDownToUp,
+ TrackElemType::RightTwistUpToDown,
+ TrackElemType::LeftFlyerTwistUp,
+ TrackElemType::LeftFlyerTwistDown,
+ TrackElemType::RightFlyerTwistUp,
+ TrackElemType::RightFlyerTwistDown,
+ };
+
+ // Update the magic number with the current number of track elements to silence
+ static_assert(EnumValue(TrackElemType::Count) == 349, "Reminder to add new track element to special dropdown list");
+
/**
*
* rct2: 0x006B4800
@@ -60,14 +254,16 @@ namespace OpenRCT2
&& state != RideConstructionState::Back)
return list;
- for (OpenRCT2::TrackElemType trackType : DropdownOrder)
+ auto& elements = list.Elements;
+
+ for (TrackElemType trackType : kSpecialElementsDropdownOrder)
{
const auto& ted = GetTrackElementDescriptor(trackType);
- if (!IsTrackEnabled(ted.definition.group))
+ if (!IsTrackEnabled(ted.definition.group) && trackType != kSeparator)
continue;
- bool entryIsDisabled;
// If the current build orientation (slope, bank, diagonal) matches the track element's, show the piece as enabled
+ bool entryIsDisabled;
if (state == RideConstructionState::Back)
{
entryIsDisabled = ted.definition.pitchEnd != buildSlope || ted.definition.rollEnd != buildBank
@@ -85,13 +281,18 @@ namespace OpenRCT2
entryIsDisabled = true;
// Check if a previous element exists, to collate entries if possible
- if (!list.Elements.empty()
- && GetTrackElementDescriptor(list.Elements.back().TrackType).description == ted.description)
+ if (!list.Elements.empty() && GetTrackElementDescriptor(elements.back().TrackType).description == ted.description)
{
// If the current element is disabled, do not add current element.
if (entryIsDisabled)
continue;
- auto& lastElement = list.Elements.back();
+
+ auto& lastElement = elements.back();
+
+ // Don't add two separators in a row
+ if (lastElement.TrackType == kSeparator && trackType == kSeparator)
+ continue;
+
// If the previous element is disabled and current element is enabled, replace the previous element
if (lastElement.Disabled && !entryIsDisabled)
{
@@ -102,9 +303,57 @@ namespace OpenRCT2
}
// If the previous element and current element are enabled, add both to the list
}
- list.Elements.push_back({ trackType, entryIsDisabled });
- list.HasActiveElements |= !entryIsDisabled;
+ elements.push_back({ trackType, entryIsDisabled });
+ list.HasActiveElements |= !entryIsDisabled && trackType != kSeparator;
}
+
+ if (elements.empty())
+ return list;
+
+ // If the very first element is a separator, remove it
+ auto firstElement = elements.begin();
+ if (firstElement->TrackType == kSeparator)
+ {
+ elements.erase(firstElement);
+ if (elements.empty())
+ return list;
+ }
+
+ // If the very last element is a separator, remove it
+ auto& lastElement = elements.back();
+ if (lastElement.TrackType == kSeparator)
+ elements.pop_back();
+
+ if (elements.size() < 20)
+ {
+ list.PreferredNumRows = elements.size();
+ return list;
+ }
+
+ list.PreferredNumRows = elements.size() / 2 + 1;
+
+ // Scan ahead of the halfway mark to see if there's a separator nearby
+ for (size_t i = 0; i < 3; i++)
+ {
+ if (list.PreferredNumRows + i > elements.size())
+ break;
+
+ auto trackPiece = elements[list.PreferredNumRows + i].TrackType;
+ if (trackPiece == TrackElemType::None)
+ {
+ list.PreferredNumRows += i + 1;
+ break;
+ }
+ }
+
+ // If the last element of the first column is a separator, remove it
+ auto& middleElement = elements[list.PreferredNumRows - 1];
+ if (middleElement.TrackType == kSeparator)
+ {
+ elements.erase(elements.begin() + list.PreferredNumRows - 1);
+ list.PreferredNumRows -= 1;
+ }
+
return list;
}
@@ -159,7 +408,7 @@ namespace OpenRCT2
entranceExitCoords = { coordsAtHeight->ToTileStart(), stationBaseZ, INVALID_DIRECTION };
- if (ride->type == RIDE_TYPE_NULL)
+ if (ride->type == kRideTypeNull)
{
entranceExitCoords.SetNull();
return entranceExitCoords;
diff --git a/src/openrct2-ui/ride/Construction.h b/src/openrct2-ui/ride/Construction.h
index 14a732369c..a275b87717 100644
--- a/src/openrct2-ui/ride/Construction.h
+++ b/src/openrct2-ui/ride/Construction.h
@@ -17,140 +17,6 @@ namespace OpenRCT2
{
enum class RideConstructionState : uint8_t;
- /**
- * Order of special track elements dropdown. Elements with the same name string must be sequential or they show up twice.
- */
- constexpr std::array DropdownOrder = {
- TrackElemType::EndStation,
- TrackElemType::SBendLeft,
- TrackElemType::SBendRight,
- TrackElemType::LeftVerticalLoop,
- TrackElemType::RightVerticalLoop,
- TrackElemType::LeftTwistDownToUp,
- TrackElemType::LeftTwistUpToDown,
- TrackElemType::RightTwistDownToUp,
- TrackElemType::RightTwistUpToDown,
- TrackElemType::HalfLoopUp,
- TrackElemType::HalfLoopDown,
- TrackElemType::LeftCorkscrewUp,
- TrackElemType::LeftCorkscrewDown,
- TrackElemType::RightCorkscrewUp,
- TrackElemType::RightCorkscrewDown,
- TrackElemType::TowerBase,
- TrackElemType::TowerSection,
- TrackElemType::LeftHalfBankedHelixUpSmall,
- TrackElemType::RightHalfBankedHelixUpSmall,
- TrackElemType::LeftHalfBankedHelixDownSmall,
- TrackElemType::RightHalfBankedHelixDownSmall,
- TrackElemType::LeftHalfBankedHelixUpLarge,
- TrackElemType::RightHalfBankedHelixUpLarge,
- TrackElemType::LeftHalfBankedHelixDownLarge,
- TrackElemType::RightHalfBankedHelixDownLarge,
- TrackElemType::Booster,
- TrackElemType::DiagBooster,
- TrackElemType::Brakes,
- TrackElemType::DiagBrakes,
- TrackElemType::Down25Brakes,
- TrackElemType::OnRidePhoto,
- TrackElemType::LeftQuarterBankedHelixLargeUp,
- TrackElemType::RightQuarterBankedHelixLargeUp,
- TrackElemType::LeftQuarterBankedHelixLargeDown,
- TrackElemType::RightQuarterBankedHelixLargeDown,
- TrackElemType::LeftQuarterHelixLargeUp,
- TrackElemType::RightQuarterHelixLargeUp,
- TrackElemType::LeftQuarterHelixLargeDown,
- TrackElemType::RightQuarterHelixLargeDown,
- TrackElemType::Waterfall,
- TrackElemType::Rapids,
- TrackElemType::Watersplash,
- TrackElemType::Whirlpool,
- TrackElemType::CableLiftHill,
- TrackElemType::ReverseFreefallSlope,
- TrackElemType::ReverseFreefallVertical,
- TrackElemType::BrakeForDrop,
- TrackElemType::LogFlumeReverser,
- TrackElemType::SpinningTunnel,
- TrackElemType::LeftBarrelRollUpToDown,
- TrackElemType::LeftBarrelRollDownToUp,
- TrackElemType::RightBarrelRollUpToDown,
- TrackElemType::RightBarrelRollDownToUp,
- TrackElemType::PoweredLift,
- TrackElemType::LeftLargeHalfLoopUp,
- TrackElemType::LeftLargeHalfLoopDown,
- TrackElemType::RightLargeHalfLoopUp,
- TrackElemType::RightLargeHalfLoopDown,
- TrackElemType::LeftFlyerTwistUp,
- TrackElemType::LeftFlyerTwistDown,
- TrackElemType::RightFlyerTwistUp,
- TrackElemType::RightFlyerTwistDown,
- TrackElemType::FlyerHalfLoopUninvertedUp,
- TrackElemType::FlyerHalfLoopInvertedDown,
- TrackElemType::FlyerHalfLoopInvertedUp,
- TrackElemType::FlyerHalfLoopUninvertedDown,
- TrackElemType::LeftFlyerCorkscrewUp,
- TrackElemType::LeftFlyerCorkscrewDown,
- TrackElemType::RightFlyerCorkscrewUp,
- TrackElemType::RightFlyerCorkscrewDown,
- TrackElemType::HeartLineTransferUp,
- TrackElemType::HeartLineTransferDown,
- TrackElemType::LeftHeartLineRoll,
- TrackElemType::RightHeartLineRoll,
- TrackElemType::MinigolfHoleA,
- TrackElemType::MinigolfHoleB,
- TrackElemType::MinigolfHoleC,
- TrackElemType::MinigolfHoleD,
- TrackElemType::MinigolfHoleE,
- TrackElemType::MultiDimInvertedFlatToDown90QuarterLoop,
- TrackElemType::Up90ToInvertedFlatQuarterLoop,
- TrackElemType::InvertedFlatToDown90QuarterLoop,
- TrackElemType::MultiDimUp90ToInvertedFlatQuarterLoop,
- TrackElemType::MultiDimFlatToDown90QuarterLoop,
- TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop,
- TrackElemType::LeftCurvedLiftHill,
- TrackElemType::RightCurvedLiftHill,
- TrackElemType::LeftReverser,
- TrackElemType::RightReverser,
- TrackElemType::AirThrustTopCap,
- TrackElemType::AirThrustVerticalDown,
- TrackElemType::AirThrustVerticalDownToLevel,
- TrackElemType::BlockBrakes,
- TrackElemType::DiagBlockBrakes,
- TrackElemType::RotationControlToggle,
- TrackElemType::LeftLargeCorkscrewUp,
- TrackElemType::LeftLargeCorkscrewDown,
- TrackElemType::RightLargeCorkscrewUp,
- TrackElemType::RightLargeCorkscrewDown,
- TrackElemType::LeftMediumHalfLoopUp,
- TrackElemType::LeftMediumHalfLoopDown,
- TrackElemType::RightMediumHalfLoopUp,
- TrackElemType::RightMediumHalfLoopDown,
- TrackElemType::LeftZeroGRollUp,
- TrackElemType::LeftZeroGRollDown,
- TrackElemType::RightZeroGRollUp,
- TrackElemType::RightZeroGRollDown,
- TrackElemType::LeftLargeZeroGRollUp,
- TrackElemType::LeftLargeZeroGRollDown,
- TrackElemType::RightLargeZeroGRollUp,
- TrackElemType::RightLargeZeroGRollDown,
- TrackElemType::LeftFlyerLargeHalfLoopUninvertedUp,
- TrackElemType::LeftFlyerLargeHalfLoopInvertedDown,
- TrackElemType::LeftFlyerLargeHalfLoopInvertedUp,
- TrackElemType::LeftFlyerLargeHalfLoopUninvertedDown,
- TrackElemType::RightFlyerLargeHalfLoopUninvertedUp,
- TrackElemType::RightFlyerLargeHalfLoopInvertedDown,
- TrackElemType::RightFlyerLargeHalfLoopInvertedUp,
- TrackElemType::RightFlyerLargeHalfLoopUninvertedDown,
- };
- constexpr size_t DropdownLength = DropdownOrder.size();
-
- // Update the magic number with the current number of track elements to silence
- static_assert(EnumValue(TrackElemType::Count) == 341, "Reminder to add new track element to special dropdown list");
-
- constexpr bool TrackPieceDirectionIsDiagonal(const uint8_t direction)
- {
- return direction >= kNumOrthogonalDirections;
- }
-
struct SpecialElement
{
OpenRCT2::TrackElemType TrackType;
@@ -161,6 +27,7 @@ namespace OpenRCT2
{
bool HasActiveElements = false;
std::vector Elements{};
+ size_t PreferredNumRows{};
};
SpecialElementsDropdownState BuildSpecialElementsList(
diff --git a/src/openrct2-ui/ride/VehicleSounds.cpp b/src/openrct2-ui/ride/VehicleSounds.cpp
index 6e5ec4a89a..9f081c4c8a 100644
--- a/src/openrct2-ui/ride/VehicleSounds.cpp
+++ b/src/openrct2-ui/ride/VehicleSounds.cpp
@@ -2,6 +2,7 @@
#include "../interface/Viewport.h"
#include "../interface/Window.h"
+#include "../windows/Windows.h"
#include
#include
diff --git a/src/openrct2-ui/scripting/CustomImages.cpp b/src/openrct2-ui/scripting/CustomImages.cpp
index d66456854f..5cd5d65ef5 100644
--- a/src/openrct2-ui/scripting/CustomImages.cpp
+++ b/src/openrct2-ui/scripting/CustomImages.cpp
@@ -83,7 +83,7 @@ namespace OpenRCT2::Scripting
images.resize(count);
auto base = GfxObjectAllocateImages(images.data(), count);
- if (base == ImageIndexUndefined)
+ if (base == kImageIndexUndefined)
{
return {};
}
diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp
index 1e66098e52..cb74e26c76 100644
--- a/src/openrct2-ui/scripting/CustomListView.cpp
+++ b/src/openrct2-ui/scripting/CustomListView.cpp
@@ -13,7 +13,7 @@
#include "../interface/Viewport.h"
#include "../interface/Widget.h"
- #include "../interface/Window.h"
+ #include "../windows/Windows.h"
#include
#include
@@ -26,7 +26,7 @@ using namespace OpenRCT2::Ui::Windows;
namespace OpenRCT2::Scripting
{
- constexpr size_t COLUMN_HEADER_HEIGHT = kListRowHeight + 1;
+ constexpr size_t kColumnHeaderHeight = kListRowHeight + 1;
template<>
ColumnSortOrder FromDuk(const DukValue& d)
@@ -431,7 +431,7 @@ ScreenSize CustomListView::GetSize()
result.height = static_cast(Items.size() * kListRowHeight);
if (ShowColumnHeaders)
{
- result.height += COLUMN_HEADER_HEIGHT;
+ result.height += kColumnHeaderHeight;
}
}
@@ -472,7 +472,7 @@ void CustomListView::MouseOver(const ScreenCoordsXY& pos, bool isMouseDown)
HighlightedCell = hitResult;
if (HighlightedCell != LastHighlightedCell)
{
- if (hitResult->Row != HEADER_ROW && OnHighlight.context() != nullptr && OnHighlight.is_function())
+ if (hitResult->Row != kHeaderRow && OnHighlight.context() != nullptr && OnHighlight.is_function())
{
auto ctx = OnHighlight.context();
duk_push_int(ctx, static_cast(HighlightedCell->Row));
@@ -489,7 +489,7 @@ void CustomListView::MouseOver(const ScreenCoordsXY& pos, bool isMouseDown)
// Update the header currently held down
if (isMouseDown)
{
- if (hitResult && hitResult->Row == HEADER_ROW)
+ if (hitResult && hitResult->Row == kHeaderRow)
{
ColumnHeaderPressedCurrentState = (hitResult->Column == ColumnHeaderPressed);
Invalidate();
@@ -511,7 +511,7 @@ void CustomListView::MouseDown(const ScreenCoordsXY& pos)
auto hitResult = GetItemIndexAt(pos);
if (hitResult)
{
- if (hitResult->Row != HEADER_ROW)
+ if (hitResult->Row != kHeaderRow)
{
if (CanSelect)
{
@@ -531,7 +531,7 @@ void CustomListView::MouseDown(const ScreenCoordsXY& pos)
}
}
}
- if (hitResult && hitResult->Row == HEADER_ROW)
+ if (hitResult && hitResult->Row == kHeaderRow)
{
if (Columns[hitResult->Column].CanSort)
{
@@ -546,7 +546,7 @@ void CustomListView::MouseDown(const ScreenCoordsXY& pos)
void CustomListView::MouseUp(const ScreenCoordsXY& pos)
{
auto hitResult = GetItemIndexAt(pos);
- if (hitResult && hitResult->Row == HEADER_ROW)
+ if (hitResult && hitResult->Row == kHeaderRow)
{
if (hitResult->Column == ColumnHeaderPressed)
{
@@ -566,7 +566,7 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollArea*
auto paletteIndex = ColourMapA[w->colours[1].colour].mid_light;
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, paletteIndex);
- int32_t y = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
+ int32_t y = ShowColumnHeaders ? kColumnHeaderHeight : 0;
for (size_t i = 0; i < Items.size(); i++)
{
if (y > dpi.y + dpi.height)
@@ -787,12 +787,12 @@ std::optional CustomListView::GetItemIndexAt(const ScreenCoordsXY& po
if (ShowColumnHeaders && absoluteY >= 0 && absoluteY < kListRowHeight)
{
result = RowColumn();
- result->Row = HEADER_ROW;
+ result->Row = kHeaderRow;
}
else
{
// Check what row we pressed
- int32_t firstY = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
+ int32_t firstY = ShowColumnHeaders ? kColumnHeaderHeight : 0;
int32_t row = (pos.y - firstY) / kListRowHeight;
if (row >= 0 && row < static_cast(Items.size()))
{
@@ -830,16 +830,17 @@ std::optional CustomListView::GetItemIndexAt(const ScreenCoordsXY& po
return result;
}
-Widget* CustomListView::GetWidget() const
+OpenRCT2::Widget* CustomListView::GetWidget() const
{
size_t scrollIndex = 0;
- for (auto widget = ParentWindow->widgets; widget->type != WindowWidgetType::Last; widget++)
+ for (WidgetIndex widgetIndex = 0; widgetIndex < ParentWindow->widgets.size(); widgetIndex++)
{
- if (widget->type == WindowWidgetType::Scroll)
+ auto& widget = ParentWindow->widgets[widgetIndex];
+ if (widget.type == WindowWidgetType::Scroll)
{
if (scrollIndex == ScrollIndex)
{
- return widget;
+ return &widget;
}
scrollIndex++;
}
diff --git a/src/openrct2-ui/scripting/CustomListView.h b/src/openrct2-ui/scripting/CustomListView.h
index b28a7fa13f..f02268bb9c 100644
--- a/src/openrct2-ui/scripting/CustomListView.h
+++ b/src/openrct2-ui/scripting/CustomListView.h
@@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows
class CustomListView
{
private:
- static constexpr int32_t HEADER_ROW = -1;
+ static constexpr int32_t kHeaderRow = -1;
WindowBase* ParentWindow{};
size_t ScrollIndex{};
diff --git a/src/openrct2-ui/scripting/CustomMenu.cpp b/src/openrct2-ui/scripting/CustomMenu.cpp
index 51dbc048f1..207157c8f4 100644
--- a/src/openrct2-ui/scripting/CustomMenu.cpp
+++ b/src/openrct2-ui/scripting/CustomMenu.cpp
@@ -16,6 +16,8 @@
#include
#include
#include
+ #include
+ #include
#include
using namespace OpenRCT2;
@@ -257,7 +259,7 @@ namespace OpenRCT2::Scripting
}
else
{
- customTool.Filter = ViewportInteractionItemAll;
+ customTool.Filter = kViewportInteractionItemAll;
}
customTool.onStart = dukValue["onStart"];
@@ -266,12 +268,14 @@ namespace OpenRCT2::Scripting
customTool.onUp = dukValue["onUp"];
customTool.onFinish = dukValue["onFinish"];
- auto toolbarWindow = WindowFindByClass(WindowClass::TopToolbar);
+ auto* windowMgr = GetWindowManager();
+ auto toolbarWindow = windowMgr->FindByClass(WindowClass::TopToolbar);
if (toolbarWindow != nullptr)
{
- // Use a widget that does not exist on top toolbar but also make sure it isn't -1 as that
- // prevents abort from being called.
- WidgetIndex widgetIndex = -2;
+ // Use a widget that does not exist on top toolbar but also make sure it isn't
+ // kWidgetIndexNull, as that prevents abort from being called.
+ // TODO: refactor this to not leech on the top toolbar.
+ WidgetIndex widgetIndex = 0xFFFE;
ToolCancel();
ToolSet(*toolbarWindow, widgetIndex, static_cast(customTool.Cursor));
ActiveCustomTool = std::move(customTool);
diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp
index 93a5cd52c3..2a6a7de696 100644
--- a/src/openrct2-ui/scripting/CustomWindow.cpp
+++ b/src/openrct2-ui/scripting/CustomWindow.cpp
@@ -9,13 +9,12 @@
#ifdef ENABLE_SCRIPTING
- #include "../UiContext.h"
#include "../UiStringIds.h"
#include "../interface/Dropdown.h"
#include "../interface/Widget.h"
#include "../scripting/ScGraphicsContext.hpp"
#include "../scripting/ScWidget.hpp"
- #include "../windows/Window.h"
+ #include "../windows/Windows.h"
#include "CustomListView.h"
#include "ScUi.hpp"
#include "ScWindow.hpp"
@@ -218,6 +217,21 @@ namespace OpenRCT2::Ui::Windows
result.imageFrameCount = AsOrDefault(dukImage["frameCount"], 0);
result.imageFrameDuration = AsOrDefault(dukImage["frameDuration"], 0);
+ if (dukImage["primaryColour"].type() == DukValue::Type::NUMBER)
+ {
+ result.imageFrameBase = result.imageFrameBase.WithPrimary(dukImage["primaryColour"].as_uint());
+
+ if (dukImage["secondaryColour"].type() == DukValue::Type::NUMBER)
+ {
+ result.imageFrameBase = result.imageFrameBase.WithSecondary(dukImage["secondaryColour"].as_uint());
+
+ if (dukImage["tertiaryColour"].type() == DukValue::Type::NUMBER)
+ {
+ result.imageFrameBase = result.imageFrameBase.WithTertiary(dukImage["tertiaryColour"].as_uint());
+ }
+ }
+ }
+
auto dukCoord = dukImage["offset"];
if (dukCoord.type() == DukValue::Type::OBJECT)
{
@@ -450,7 +464,8 @@ namespace OpenRCT2::Ui::Windows
{
frame_no = 0;
}
- WidgetInvalidate(*this, WIDX_TAB_0 + this->page);
+
+ InvalidateWidget(WIDX_TAB_0 + this->page);
}
}
@@ -459,9 +474,9 @@ namespace OpenRCT2::Ui::Windows
// Since the plugin may alter widget positions and sizes during an update event,
// we need to force an update for all list view scrollbars
WidgetIndex widgetIndex = 0;
- for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
+ for (auto& widget : widgets)
{
- if (widget->type == WindowWidgetType::Scroll)
+ if (widget.type == WindowWidgetType::Scroll)
{
WidgetScrollUpdateThumbs(*this, widgetIndex);
}
@@ -496,13 +511,13 @@ namespace OpenRCT2::Ui::Windows
ft.Add(desc.Title.c_str());
size_t scrollIndex = 0;
- for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
+ for (const auto& widget : widgets)
{
- if (widget->type == WindowWidgetType::Scroll)
+ if (widget.type == WindowWidgetType::Scroll)
{
auto& listView = _info.ListViews[scrollIndex];
- auto wwidth = widget->width() + 1 - 2;
- auto wheight = widget->height() + 1 - 2;
+ auto wwidth = widget.width() + 1 - 2;
+ auto wheight = widget.height() + 1 - 2;
if (listView.GetScrollbars() == ScrollbarType::Horizontal
|| listView.GetScrollbars() == ScrollbarType::Both)
{
@@ -565,8 +580,11 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_CLOSE:
- WindowClose(*this);
+ {
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->Close(*this);
break;
+ }
default:
{
if (widgetIndex >= WIDX_TAB_0
@@ -626,7 +644,7 @@ namespace OpenRCT2::Ui::Windows
widget--;
auto selectedIndex = widgetDesc->SelectedIndex;
const auto& items = widgetDesc->Items;
- const auto numItems = std::min(items.size(), Dropdown::ItemsMaxSize);
+ const auto numItems = std::min(items.size(), Dropdown::kItemsMaxSize);
for (size_t i = 0; i < numItems; i++)
{
gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM;
@@ -765,9 +783,9 @@ namespace OpenRCT2::Ui::Windows
std::optional GetViewportWidgetIndex()
{
WidgetIndex widgetIndex = 0;
- for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
+ for (auto& widget : widgets)
{
- if (widget->type == WindowWidgetType::Viewport)
+ if (widget.type == WindowWidgetType::Viewport)
{
return widgetIndex;
}
@@ -886,7 +904,7 @@ namespace OpenRCT2::Ui::Windows
widget.top = 17;
widget.bottom = 43;
widget.image = ImageId(SPR_TAB, FilterPaletteID::PaletteNull);
- widget.tooltip = STR_NONE;
+ widget.tooltip = kStringIdNone;
widgetList.push_back(widget);
_info.WidgetIndexMap.push_back(std::numeric_limits::max());
}
@@ -928,8 +946,7 @@ namespace OpenRCT2::Ui::Windows
}
}
- widgetList.push_back(kWidgetsEnd);
- widgets = widgetList.data();
+ SetWidgets(widgetList);
WindowInitScrollWidgets(*this);
UpdateViewport();
@@ -944,7 +961,7 @@ namespace OpenRCT2::Ui::Windows
widget.right = desc.X + desc.Width - 1;
widget.bottom = desc.Y + desc.Height - 1;
widget.content = std::numeric_limits::max();
- widget.tooltip = STR_NONE;
+ widget.tooltip = kStringIdNone;
widget.sztooltip = const_cast(desc.Tooltip.c_str());
widget.flags |= WIDGET_FLAGS::TOOLTIP_IS_STRING;
if (desc.IsDisabled)
@@ -1016,7 +1033,7 @@ namespace OpenRCT2::Ui::Windows
widget.top = desc.Y + 1;
widget.bottom = desc.Y + desc.Height - 2;
widget.text = STR_DROPDOWN_GLYPH;
- widget.tooltip = STR_NONE;
+ widget.tooltip = kStringIdNone;
if (desc.IsDisabled)
widget.flags |= WIDGET_FLAGS::IS_DISABLED;
widgetList.push_back(widget);
@@ -1067,7 +1084,7 @@ namespace OpenRCT2::Ui::Windows
widget.top = desc.Y + 1;
widget.bottom = desc.Y + desc.Height - 2;
widget.text = STR_NUMERIC_UP;
- widget.tooltip = STR_NONE;
+ widget.tooltip = kStringIdNone;
if (desc.IsDisabled)
widget.flags |= WIDGET_FLAGS::IS_DISABLED;
widget.flags |= WIDGET_FLAGS::IS_HOLDABLE;
@@ -1089,7 +1106,7 @@ namespace OpenRCT2::Ui::Windows
else if (desc.Type == "viewport")
{
widget.type = WindowWidgetType::Viewport;
- widget.text = STR_NONE;
+ widget.text = kStringIdNone;
widgetList.push_back(widget);
}
}
@@ -1097,7 +1114,8 @@ namespace OpenRCT2::Ui::Windows
static rct_windownumber GetNewWindowNumber()
{
auto result = _nextWindowNumber++;
- while (WindowFindByNumber(WindowClass::Custom, result) != nullptr)
+ auto* windowMgr = GetWindowManager();
+ while (windowMgr->FindByNumber(WindowClass::Custom, result) != nullptr)
{
result++;
}
@@ -1111,15 +1129,17 @@ namespace OpenRCT2::Ui::Windows
{
auto desc = CustomWindowDesc::FromDukValue(dukDesc);
uint16_t windowFlags = WF_RESIZABLE | WF_TRANSPARENT;
+ auto* windowMgr = GetWindowManager();
+
CustomWindow* window{};
if (desc.X && desc.Y)
{
- window = WindowCreate(
+ window = windowMgr->Create(
WindowClass::Custom, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags, owner, desc);
}
else
{
- window = WindowCreate(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
+ window = windowMgr->Create(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
}
return window;
}
@@ -1183,7 +1203,9 @@ namespace OpenRCT2::Ui::Windows
{
customWidgetInfo->Text = value;
w->widgets[widgetIndex].string = customWidgetInfo->Text.data();
- WidgetInvalidate(*w, widgetIndex);
+
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateWidget(*w, widgetIndex);
}
}
}
@@ -1217,7 +1239,9 @@ namespace OpenRCT2::Ui::Windows
{
customWidgetInfo->Colour = colour;
widget.image = GetColourButtonImage(colour);
- WidgetInvalidate(*w, widgetIndex);
+
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateWidget(*w, widgetIndex);
std::vector args;
auto ctx = customWidgetInfo->OnChange.context();
@@ -1262,7 +1286,8 @@ namespace OpenRCT2::Ui::Windows
}
customWidgetInfo->SelectedIndex = selectedIndex;
- WidgetInvalidate(*w, widgetIndex);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateWidget(*w, widgetIndex);
if (lastSelectedIndex != selectedIndex)
{
@@ -1468,7 +1493,8 @@ namespace OpenRCT2::Ui::Windows
for (auto& window : customWindows)
{
- WindowClose(*window.get());
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->Close(*window.get());
}
}
diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp
index 1b9503021e..778a961353 100644
--- a/src/openrct2-ui/scripting/ScUi.hpp
+++ b/src/openrct2-ui/scripting/ScUi.hpp
@@ -11,7 +11,7 @@
#ifdef ENABLE_SCRIPTING
- #include "../windows/Window.h"
+ #include "../windows/Windows.h"
#include "CustomMenu.h"
#include "ScImageManager.hpp"
#include "ScTileSelection.hpp"
@@ -183,23 +183,25 @@ namespace OpenRCT2::Scripting
void closeWindows(std::string classification, DukValue id)
{
+ auto* windowMgr = Ui::GetWindowManager();
auto cls = GetClassification(classification);
if (cls != WindowClass::Null)
{
if (id.type() == DukValue::Type::NUMBER)
{
- WindowCloseByNumber(cls, id.as_uint());
+ windowMgr->CloseByNumber(cls, id.as_uint());
}
else
{
- WindowCloseByClass(cls);
+ windowMgr->CloseByClass(cls);
}
}
}
void closeAllWindows()
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
}
std::shared_ptr getWindow(DukValue a) const
@@ -238,15 +240,15 @@ namespace OpenRCT2::Scripting
{
try
{
- constexpr int32_t MaxLengthAllowed = 4096;
+ constexpr int32_t kMaxLengthAllowed = 4096;
auto plugin = _scriptEngine.GetExecInfo().GetCurrentPlugin();
auto title = desc["title"].as_string();
auto description = desc["description"].as_string();
auto initialValue = AsOrDefault(desc["initialValue"], "");
- auto maxLength = AsOrDefault(desc["maxLength"], MaxLengthAllowed);
+ auto maxLength = AsOrDefault(desc["maxLength"], kMaxLengthAllowed);
auto callback = desc["callback"];
WindowTextInputOpen(
- title, description, initialValue, std::clamp(maxLength, 0, MaxLengthAllowed),
+ title, description, initialValue, std::clamp(maxLength, 0, kMaxLengthAllowed),
[this, plugin, callback](std::string_view value) {
auto dukValue = ToDuk(_scriptEngine.GetContext(), value);
_scriptEngine.ExecutePluginCall(plugin, callback, { dukValue }, false);
diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp
index 6bee082c28..6a09c53802 100644
--- a/src/openrct2-ui/scripting/ScViewport.hpp
+++ b/src/openrct2-ui/scripting/ScViewport.hpp
@@ -18,6 +18,7 @@
#include
#include
#include
+ #include
#include
namespace OpenRCT2::Scripting
@@ -251,7 +252,8 @@ namespace OpenRCT2::Scripting
if (_class == WindowClass::MainWindow)
return WindowGetMain();
- return WindowFindByNumber(_class, _number);
+ auto* windowMgr = Ui::GetWindowManager();
+ return windowMgr->FindByNumber(_class, _number);
}
Viewport* GetViewport() const
diff --git a/src/openrct2-ui/scripting/ScWidget.hpp b/src/openrct2-ui/scripting/ScWidget.hpp
index 97a4aaed2f..3e55565c92 100644
--- a/src/openrct2-ui/scripting/ScWidget.hpp
+++ b/src/openrct2-ui/scripting/ScWidget.hpp
@@ -12,7 +12,6 @@
#ifdef ENABLE_SCRIPTING
#include "../interface/Widget.h"
- #include "../interface/Window.h"
#include "CustomListView.h"
#include "CustomWindow.h"
#include "ScViewport.hpp"
@@ -22,6 +21,7 @@
#include
#include
#include
+ #include
namespace OpenRCT2::Scripting
{
@@ -115,8 +115,6 @@ namespace OpenRCT2::Scripting
return "progress_bar";
case WindowWidgetType::Custom:
return "custom";
- case WindowWidgetType::Last:
- return "last";
}
}
return "unknown";
@@ -393,7 +391,8 @@ namespace OpenRCT2::Scripting
if (_class == WindowClass::MainWindow)
return WindowGetMain();
- return WindowFindByNumber(_class, _number);
+ auto* windowMgr = Ui::GetWindowManager();
+ return windowMgr->FindByNumber(_class, _number);
}
Widget* GetWidget() const
@@ -420,14 +419,15 @@ namespace OpenRCT2::Scripting
{
if (widget != nullptr)
{
+ auto* windowMgr = Ui::GetWindowManager();
if (widget->type == WindowWidgetType::DropdownMenu)
{
- WidgetInvalidateByNumber(_class, _number, _widgetIndex + 1);
+ windowMgr->InvalidateWidgetByNumber(_class, _number, _widgetIndex + 1);
}
else if (widget->type == WindowWidgetType::Spinner)
{
- WidgetInvalidateByNumber(_class, _number, _widgetIndex + 1);
- WidgetInvalidateByNumber(_class, _number, _widgetIndex + 2);
+ windowMgr->InvalidateWidgetByNumber(_class, _number, _widgetIndex + 1);
+ windowMgr->InvalidateWidgetByNumber(_class, _number, _widgetIndex + 2);
}
}
Invalidate();
@@ -435,7 +435,8 @@ namespace OpenRCT2::Scripting
void Invalidate()
{
- WidgetInvalidateByNumber(_class, _number, _widgetIndex);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateWidgetByNumber(_class, _number, _widgetIndex);
}
};
@@ -505,7 +506,7 @@ namespace OpenRCT2::Scripting
auto widget = GetWidget();
if (widget != nullptr && (widget->type == WindowWidgetType::FlatBtn || widget->type == WindowWidgetType::ImgBtn))
{
- if (GetTargetAPIVersion() <= API_VERSION_63_G2_REORDER)
+ if (GetTargetAPIVersion() <= kApiVersionG2Reorder)
{
return LegacyIconIndex(widget->image.GetIndex());
}
diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp
index 231b7acb1a..4d620acc30 100644
--- a/src/openrct2-ui/scripting/ScWindow.hpp
+++ b/src/openrct2-ui/scripting/ScWindow.hpp
@@ -218,11 +218,9 @@ namespace OpenRCT2::Scripting
auto w = GetWindow();
if (w != nullptr)
{
- WidgetIndex widgetIndex = 0;
- for (auto widget = w->widgets; widget->type != WindowWidgetType::Last; widget++)
+ for (WidgetIndex widgetIndex = 0; widgetIndex < w->widgets.size(); widgetIndex++)
{
result.push_back(ScWidget::ToDukValue(ctx, w, widgetIndex));
- widgetIndex++;
}
}
return result;
@@ -307,7 +305,8 @@ namespace OpenRCT2::Scripting
auto w = GetWindow();
if (w != nullptr)
{
- WindowClose(*w);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->Close(*w);
}
}
@@ -328,10 +327,11 @@ namespace OpenRCT2::Scripting
void bringToFront()
{
- auto w = GetWindow();
+ auto* w = GetWindow();
if (w != nullptr)
{
- WindowBringToFront(*w);
+ auto* windowMgr = Ui::GetWindowManager();
+ w = windowMgr->BringToFront(*w);
w->flags |= WF_WHITE_BORDER_MASK;
}
}
@@ -362,7 +362,8 @@ namespace OpenRCT2::Scripting
private:
WindowBase* GetWindow() const
{
- return WindowFindByNumber(_class, _number);
+ auto* windowMgr = Ui::GetWindowManager();
+ return windowMgr->FindByNumber(_class, _number);
}
};
} // namespace OpenRCT2::Scripting
diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp
index 9ffe187727..81f615bdbb 100644
--- a/src/openrct2-ui/title/TitleSequencePlayer.cpp
+++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp
@@ -12,7 +12,7 @@
#include "../interface/Window.h"
#include
-#include
+#include
#include
#include
#include
@@ -34,7 +34,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -406,31 +405,32 @@ namespace OpenRCT2::Title
void CloseParkSpecificWindows()
{
- WindowCloseByClass(WindowClass::ConstructRide);
- WindowCloseByClass(WindowClass::DemolishRidePrompt);
- WindowCloseByClass(WindowClass::EditorInventionListDrag);
- WindowCloseByClass(WindowClass::EditorInventionList);
- WindowCloseByClass(WindowClass::EditorObjectSelection);
- WindowCloseByClass(WindowClass::EditorObjectiveOptions);
- WindowCloseByClass(WindowClass::EditorScenarioOptions);
- WindowCloseByClass(WindowClass::Finances);
- WindowCloseByClass(WindowClass::FirePrompt);
- WindowCloseByClass(WindowClass::GuestList);
- WindowCloseByClass(WindowClass::InstallTrack);
- WindowCloseByClass(WindowClass::Peep);
- WindowCloseByClass(WindowClass::Ride);
- WindowCloseByClass(WindowClass::RideConstruction);
- WindowCloseByClass(WindowClass::RideList);
- WindowCloseByClass(WindowClass::Scenery);
- WindowCloseByClass(WindowClass::Staff);
- WindowCloseByClass(WindowClass::TrackDeletePrompt);
- WindowCloseByClass(WindowClass::TrackDesignList);
- WindowCloseByClass(WindowClass::TrackDesignPlace);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::ConstructRide);
+ windowMgr->CloseByClass(WindowClass::DemolishRidePrompt);
+ windowMgr->CloseByClass(WindowClass::EditorInventionListDrag);
+ windowMgr->CloseByClass(WindowClass::EditorInventionList);
+ windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
+ windowMgr->CloseByClass(WindowClass::EditorObjectiveOptions);
+ windowMgr->CloseByClass(WindowClass::EditorScenarioOptions);
+ windowMgr->CloseByClass(WindowClass::Finances);
+ windowMgr->CloseByClass(WindowClass::FirePrompt);
+ windowMgr->CloseByClass(WindowClass::GuestList);
+ windowMgr->CloseByClass(WindowClass::InstallTrack);
+ windowMgr->CloseByClass(WindowClass::Peep);
+ windowMgr->CloseByClass(WindowClass::Ride);
+ windowMgr->CloseByClass(WindowClass::RideConstruction);
+ windowMgr->CloseByClass(WindowClass::RideList);
+ windowMgr->CloseByClass(WindowClass::Scenery);
+ windowMgr->CloseByClass(WindowClass::Staff);
+ windowMgr->CloseByClass(WindowClass::TrackDeletePrompt);
+ windowMgr->CloseByClass(WindowClass::TrackDesignList);
+ windowMgr->CloseByClass(WindowClass::TrackDesignPlace);
}
void PrepareParkForPlayback()
{
- auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
+ auto windowManager = Ui::GetWindowManager();
auto& gameState = GetGameState();
windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation);
ResetEntitySpatialIndices();
diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp
index cd3a0bf9c0..63ab9710ca 100644
--- a/src/openrct2-ui/windows/About.cpp
+++ b/src/openrct2-ui/windows/About.cpp
@@ -11,8 +11,7 @@
#include
#include
-#include
-#include
+#include
#include
#include
#include
@@ -20,6 +19,7 @@
#include
#include
#include
+#include
namespace OpenRCT2::Ui::Windows
{
@@ -63,26 +63,24 @@ namespace OpenRCT2::Ui::Windows
MakeRemapWidget({ 94, 17 }, { 91, TABHEIGHT - 16 }, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB_LARGE)
// clang-format off
- static Widget _windowAboutOpenRCT2Widgets[] = {
+ static constexpr Widget _windowAboutOpenRCT2Widgets[] = {
WIDGETS_MAIN,
MakeWidget({10, 60}, {WW - 20, 20}, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_ABOUT_OPENRCT2_DESCRIPTION), // Introduction
- MakeWidget({30, 90}, {128, 128}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NONE), // OpenRCT2 Logo
- MakeWidget({168, 100}, {173, 24}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NONE), // Build version
+ MakeWidget({30, 90}, {128, 128}, WindowWidgetType::Placeholder, WindowColour::Secondary, kStringIdNone), // OpenRCT2 Logo
+ MakeWidget({168, 100}, {173, 24}, WindowWidgetType::Placeholder, WindowColour::Secondary, kStringIdNone), // Build version
MakeWidget({344, 100 }, {24, 24}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_COPY), STR_COPY_BUILD_HASH ), // "Copy build info" button
MakeWidget({168, 115 + 20}, {200, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_UPDATE_AVAILABLE ), // "new version" button
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
- kWidgetsEnd,
};
// clang-format on
- static Widget _windowAboutRCT2Widgets[] = {
+ static constexpr Widget _windowAboutRCT2Widgets[] = {
WIDGETS_MAIN,
- kWidgetsEnd,
};
- static Widget* _windowAboutPageWidgets[] = {
+ static constexpr std::span _windowAboutPageWidgets[] = {
_windowAboutOpenRCT2Widgets,
_windowAboutRCT2Widgets,
};
@@ -92,9 +90,6 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = _windowAboutOpenRCT2Widgets;
-
- WindowInitScrollWidgets(*this);
SetPage(WINDOW_ABOUT_PAGE_OPENRCT2);
}
@@ -119,7 +114,7 @@ namespace OpenRCT2::Ui::Windows
ContextOpenWindowView(WV_NEW_VERSION_INFO);
break;
case WIDX_COPY_BUILD_INFO:
- SDL_SetClipboardText(gVersionInfoFull);
+ OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(gVersionInfoFull);
break;
case WIDX_CONTRIBUTORS_BUTTON:
ContextOpenWindowView(WV_CONTRIBUTORS);
@@ -174,7 +169,7 @@ namespace OpenRCT2::Ui::Windows
page = p;
frame_no = 0;
pressed_widgets = 0;
- widgets = _windowAboutPageWidgets[p];
+ SetWidgets(_windowAboutPageWidgets[p]);
switch (p)
{
@@ -186,7 +181,7 @@ namespace OpenRCT2::Ui::Windows
break;
}
- WindowInitScrollWidgets(*this);
+ InitScrollWidgets();
Invalidate();
}
@@ -215,7 +210,6 @@ namespace OpenRCT2::Ui::Windows
if (OpenRCT2::GetContext()->HasNewVersionInfo())
{
widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button;
- _windowAboutOpenRCT2Widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button;
}
// Draw the rest of the text
@@ -286,6 +280,7 @@ namespace OpenRCT2::Ui::Windows
*/
WindowBase* AboutOpen()
{
- return WindowFocusOrCreate(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
+ auto* windowMgr = GetWindowManager();
+ return windowMgr->FocusOrCreate(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 622a80f3f3..1f3dbe48dd 100644
--- a/src/openrct2-ui/windows/AssetPacks.cpp
+++ b/src/openrct2-ui/windows/AssetPacks.cpp
@@ -10,7 +10,7 @@
#include "../UiStringIds.h"
#include
-#include
+#include
#include
#include
#include
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
namespace OpenRCT2::Ui::Windows
{
@@ -40,7 +41,7 @@ namespace OpenRCT2::Ui::Windows
};
// clang-format off
- static Widget WindowAssetPacksWidgets[] = {
+ static constexpr Widget WindowAssetPacksWidgets[] = {
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_HIGH_PRIORITY),
MakeWidget({ 0, 0 }, { 0, 147 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL),
@@ -48,7 +49,6 @@ namespace OpenRCT2::Ui::Windows
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),
- kWidgetsEnd,
};
// clang-format on
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = WindowAssetPacksWidgets;
+ SetWidgets(WindowAssetPacksWidgets);
WindowInitScrollWidgets(*this);
}
@@ -344,7 +344,9 @@ namespace OpenRCT2::Ui::Windows
WindowBase* AssetPacksOpen()
{
+ auto* windowMgr = GetWindowManager();
auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN;
- return WindowFocusOrCreate(WindowClass::AssetPacks, WW, WH, flags);
+
+ return windowMgr->FocusOrCreate(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 e94402770e..c34210b4d7 100644
--- a/src/openrct2-ui/windows/Banner.cpp
+++ b/src/openrct2-ui/windows/Banner.cpp
@@ -12,7 +12,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -63,7 +64,7 @@ namespace OpenRCT2::Ui::Windows
STR_TEXT_COLOUR_PALESILVER,
};
- static Widget window_banner_widgets[] = {
+ static constexpr Widget window_banner_widgets[] = {
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
MakeWidget({ 3, 17}, {85, 60}, WindowWidgetType::Viewport, WindowColour::Secondary, 0x0FFFFFFFE ), // tab content panel
MakeWidget({WW - 25, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_CHANGE_BANNER_TEXT_TIP ), // change banner button
@@ -72,7 +73,6 @@ namespace OpenRCT2::Ui::Windows
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
- kWidgetsEnd,
};
// clang-format on
@@ -83,10 +83,10 @@ namespace OpenRCT2::Ui::Windows
void CreateViewport()
{
- Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
+ const auto& viewportWidget = widgets[WIDX_VIEWPORT];
ViewportCreate(
- this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
- (viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos));
+ this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 },
+ (viewportWidget.width()) - 1, (viewportWidget.height()) - 1, Focus(_bannerViewPos));
if (viewport != nullptr)
viewport->flags = Config::Get().general.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
@@ -131,7 +131,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = window_banner_widgets;
+ SetWidgets(window_banner_widgets);
WindowInitScrollWidgets(*this);
}
@@ -279,13 +279,13 @@ namespace OpenRCT2::Ui::Windows
{
return;
}
- Widget* colourBtn = &window_banner_widgets[WIDX_MAIN_COLOUR];
- colourBtn->type = WindowWidgetType::Empty;
+ Widget& colourBtn = 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;
+ colourBtn.type = WindowWidgetType::ColourBtn;
}
pressed_widgets &= ~(1uLL << WIDX_BANNER_NO_ENTRY);
disabled_widgets &= ~(
@@ -296,9 +296,9 @@ namespace OpenRCT2::Ui::Windows
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];
+ colourBtn.image = GetColourButtonImage(banner->colour);
+ Widget& dropDownWidget = widgets[WIDX_TEXT_COLOUR_DROPDOWN];
+ dropDownWidget.text = BannerColouredTextFormats[banner->text_colour];
}
void OnResize() override
@@ -313,12 +313,13 @@ namespace OpenRCT2::Ui::Windows
*/
WindowBase* BannerOpen(rct_windownumber number)
{
- auto w = static_cast(WindowBringToFrontByNumber(WindowClass::Banner, number));
+ auto* windowMgr = GetWindowManager();
+ auto w = static_cast(windowMgr->BringToFrontByNumber(WindowClass::Banner, number));
if (w != nullptr)
return w;
- w = WindowCreate(WindowClass::Banner, WW, WH, 0);
+ w = windowMgr->Create(WindowClass::Banner, WW, WH, 0);
if (w != nullptr)
w->Initialise(number);
diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp
index 7de4e4703e..71a000a4a6 100644
--- a/src/openrct2-ui/windows/Changelog.cpp
+++ b/src/openrct2-ui/windows/Changelog.cpp
@@ -9,8 +9,7 @@
#include
#include
-#include
-#include
+#include
#include
#include
#include
@@ -21,6 +20,7 @@
#include
#include
#include
+#include
#include
namespace OpenRCT2::Ui::Windows
@@ -47,7 +47,6 @@ namespace OpenRCT2::Ui::Windows
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
- kWidgetsEnd,
};
// clang-format on
@@ -125,7 +124,7 @@ namespace OpenRCT2::Ui::Windows
void OnOpen() override
{
- widgets = _windowChangelogWidgets;
+ SetWidgets(_windowChangelogWidgets);
WindowInitScrollWidgets(*this);
min_width = MIN_WW;
@@ -319,7 +318,8 @@ namespace OpenRCT2::Ui::Windows
WindowBase* ChangelogOpen(int personality)
{
- auto* window = WindowBringToFrontByClass(WindowClass::Changelog);
+ auto* windowMgr = GetWindowManager();
+ auto* window = windowMgr->BringToFrontByClass(WindowClass::Changelog);
if (window == nullptr)
{
// Create a new centred window
@@ -329,7 +329,7 @@ namespace OpenRCT2::Ui::Windows
int32_t height = (screenHeight * 4) / 5;
auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height);
- auto* newWindow = WindowCreate(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
+ auto* newWindow = windowMgr->Create(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
newWindow->SetPersonality(personality);
return newWindow;
}
diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp
index 91773863e4..7eb93f1c85 100644
--- a/src/openrct2-ui/windows/Cheats.cpp
+++ b/src/openrct2-ui/windows/Cheats.cpp
@@ -12,7 +12,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -219,7 +220,7 @@ static constexpr int32_t TAB_START = 3;
MakeTab ({158, 17}, STR_RIDE_CHEATS_TIP ), /* tab 4 */ \
MakeTab ({189, 17}, STR_WEATHER_NATURE_CHEATS_TIP ) /* tab 7 */
-static Widget window_cheats_money_widgets[] =
+static constexpr Widget window_cheats_money_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget ({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAKE_PARK_NO_MONEY), // No money
@@ -228,10 +229,9 @@ static Widget window_cheats_money_widgets[] =
MakeWidget ({ 11, 111}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_MONEY ), // add money
MakeWidget ({127, 111}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_SET_MONEY ), // set money
MakeWidget ({ 11, 145}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_CLEAR_LOAN ), // Clear loan
- kWidgetsEnd,
};
-static Widget window_cheats_date_widgets[] =
+static constexpr Widget window_cheats_date_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget ({ 5, 48}, {238, 99} , WindowWidgetType::Groupbox, WindowColour::Secondary, STR_DATE_SET ), // Date group
@@ -240,10 +240,9 @@ static Widget window_cheats_date_widgets[] =
MakeSpinnerWidgets({120, 103}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // Day box
MakeWidget ({ 11, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_SET ), // Set Date
MakeWidget ({127, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_RESET), // Reset Date
- kWidgetsEnd,
};
-static Widget window_cheats_guests_widgets[] =
+static constexpr Widget window_cheats_guests_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_LARGE_TRAM_GUESTS, STR_CHEAT_LARGE_TRAM_GUESTS_TIP), // large tram
@@ -278,11 +277,9 @@ static Widget window_cheats_guests_widgets[] =
MakeWidget({ 11, 380+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_PRICE, STR_CHEAT_IGNORE_PRICE_TIP ), // guests ignore price
MakeWidget({ 11, 397+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_VANDALISM, STR_CHEAT_DISABLE_VANDALISM_TIP), // disable vandalism
MakeWidget({ 11, 414+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_LITTERING, STR_CHEAT_DISABLE_LITTERING_TIP), // disable littering
-
- kWidgetsEnd,
};
-static Widget window_cheats_staff_widgets[] =
+static constexpr Widget window_cheats_staff_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget ({ 5, 357-309}, {238, 35}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_STAFF_GROUP ), // Staff group
@@ -296,11 +293,9 @@ static Widget window_cheats_staff_widgets[] =
MakeWidget ({127, 292-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_MOWED_GRASS ), // Mowed grass
MakeWidget ({ 11, 313-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_WATER_PLANTS ), // Water plants
MakeWidget ({ 11, 334-164}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_PLANT_AGING, STR_CHEAT_DISABLE_PLANT_AGING_TIP ), // Disable plant ageing
-
- kWidgetsEnd,
};
-static Widget window_cheats_park_widgets[] =
+static constexpr Widget window_cheats_park_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget ({ 5, 48}, {238, 60}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GENERAL_GROUP ), // General group
@@ -319,11 +314,9 @@ static Widget window_cheats_park_widgets[] =
MakeWidget ({ 11, 207}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_BUILD_IN_PAUSE_MODE, STR_CHEAT_BUILD_IN_PAUSE_MODE_TIP ), // Build in pause mode
MakeWidget ({ 11, 224}, 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, 241}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES_TIP), // Allow special colours in dropdown
-
- kWidgetsEnd,
};
-static Widget window_cheats_rides_widgets[] =
+static constexpr Widget window_cheats_rides_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_FIX_ALL_RIDES, STR_CHEAT_FIX_ALL_RIDES_TIP ), // Fix all rides
@@ -349,23 +342,21 @@ static Widget window_cheats_rides_widgets[] =
MakeWidget({ 11, 325}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES ), // Show vehicles from other track types
MakeWidget({ 11, 342}, 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, 359}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_RESEARCH_STATUS, STR_CHEAT_IGNORE_RESEARCH_STATUS_TIP ), // Ignore Research Status
- kWidgetsEnd,
};
-static Widget window_cheats_weather_widgets[] =
+static constexpr Widget window_cheats_weather_widgets[] =
{
MAIN_CHEATS_WIDGETS,
MakeWidget ({ 5, 48}, {238, 50}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_WEATHER_GROUP ), // Weather group
- MakeWidget ({126, 62}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather
+ MakeWidget ({126, 62}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather
MakeWidget ({225, 63}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather
MakeWidget ({ 11, 80}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_FREEZE_WEATHER, STR_CHEAT_FREEZE_WEATHER_TIP), // Freeze weather
MakeWidget ({ 5, 102}, {238, 37}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_FAUNA ), // Fauna group
MakeWidget ({ 11, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CREATE_DUCKS, STR_CREATE_DUCKS_TIP ), // Create ducks
MakeWidget ({127, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_REMOVE_DUCKS, STR_REMOVE_DUCKS_TIP ), // Remove ducks
- kWidgetsEnd,
};
-static Widget *window_cheats_page_widgets[] =
+static constexpr std::span window_cheats_page_widgets[] =
{
window_cheats_money_widgets,
window_cheats_date_widgets,
@@ -512,13 +503,6 @@ static StringId window_cheats_page_titles[] = {
void OnPrepareDraw() override
{
- auto* targetWidgets = window_cheats_page_widgets[page];
- if (widgets != targetWidgets)
- {
- widgets = targetWidgets;
- WindowInitScrollWidgets(*this);
- }
-
pressed_widgets = 0;
disabled_widgets = 0;
@@ -592,11 +576,16 @@ static StringId window_cheats_page_titles[] = {
}
// Current weather
- window_cheats_weather_widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.ClimateCurrent.Weather)];
+ if (page == WINDOW_CHEATS_PAGE_WEATHER)
+ {
+ widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.ClimateCurrent.Weather)];
+ }
// Staff speed
- window_cheats_staff_widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(
- gameState.Cheats.selectedStaffSpeed)];
+ if (page == WINDOW_CHEATS_PAGE_STAFF)
+ {
+ widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(gameState.Cheats.selectedStaffSpeed)];
+ }
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
{
@@ -753,18 +742,18 @@ static StringId window_cheats_page_titles[] = {
hold_down_widgets = window_cheats_page_hold_down_widgets[p];
pressed_widgets = 0;
- widgets = window_cheats_page_widgets[p];
+ SetWidgets(window_cheats_page_widgets[p]);
auto maxY = 0;
- auto* widget = &widgets[WIDX_TAB_CONTENT];
- while (widget->type != WindowWidgetType::Last)
+ for (WidgetIndex widgetIdx = WIDX_TAB_CONTENT; widgetIdx < widgets.size(); widgetIdx++)
{
- maxY = std::max(maxY, widget->bottom);
- widget++;
+ auto& widget = widgets[widgetIdx];
+ maxY = std::max(maxY, widget.bottom);
}
maxY += 6;
Invalidate();
+ WindowInitScrollWidgets(*this);
height = maxY;
widgets[WIDX_BACKGROUND].bottom = maxY - 1;
widgets[WIDX_PAGE_BACKGROUND].bottom = maxY - 1;
@@ -881,6 +870,8 @@ static StringId window_cheats_page_titles[] = {
void OnMouseDownDate(WidgetIndex widgetIndex)
{
+ auto* windowMgr = Ui::GetWindowManager();
+
switch (widgetIndex)
{
case WIDX_YEAR_UP:
@@ -925,14 +916,14 @@ static StringId window_cheats_page_titles[] = {
{
auto setDateAction = ParkSetDateAction(_yearSpinnerValue - 1, _monthSpinnerValue - 1, _daySpinnerValue - 1);
GameActions::Execute(&setDateAction);
- WindowInvalidateByClass(WindowClass::BottomToolbar);
+ windowMgr->InvalidateByClass(WindowClass::BottomToolbar);
break;
}
case WIDX_DATE_RESET:
{
auto setDateAction = ParkSetDateAction(0, 0, 0);
GameActions::Execute(&setDateAction);
- WindowInvalidateByClass(WindowClass::BottomToolbar);
+ windowMgr->InvalidateByClass(WindowClass::BottomToolbar);
InvalidateWidget(WIDX_YEAR_BOX);
InvalidateWidget(WIDX_MONTH_BOX);
InvalidateWidget(WIDX_DAY_BOX);
@@ -1357,10 +1348,11 @@ static StringId window_cheats_page_titles[] = {
WindowBase* CheatsOpen()
{
- auto* window = WindowBringToFrontByClass(WindowClass::Cheats);
+ auto* windowMgr = GetWindowManager();
+ auto* window = windowMgr->BringToFrontByClass(WindowClass::Cheats);
if (window == nullptr)
{
- window = WindowCreate(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
+ window = windowMgr->Create(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
}
return window;
}
diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp
index e49673451c..bcadd37b50 100644
--- a/src/openrct2-ui/windows/ClearScenery.cpp
+++ b/src/openrct2-ui/windows/ClearScenery.cpp
@@ -11,13 +11,14 @@
#include
#include
-#include
+#include
#include
#include
#include
#include
#include
#include
+#include
#include
#include
@@ -42,11 +43,11 @@ namespace OpenRCT2::Ui::Windows
static constexpr ScreenSize CLEAR_SCENERY_BUTTON = { 24, 24 };
- static Widget window_clear_scenery_widgets[] = {
+ static constexpr 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
+ kStringIdNone), // preview box
MakeRemapWidget(
{ 28, 18 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE,
STR_ADJUST_SMALLER_LAND_TIP), // decrement size
@@ -62,7 +63,6 @@ namespace OpenRCT2::Ui::Windows
MakeRemapWidget(
{ 67, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_FOOTPATH,
STR_CLEAR_SCENERY_REMOVE_FOOTPATHS_TIP), // footpaths
- kWidgetsEnd,
};
class CleanSceneryWindow final : public Window
@@ -76,7 +76,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = window_clear_scenery_widgets;
+ SetWidgets(window_clear_scenery_widgets);
hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT);
WindowInitScrollWidgets(*this);
WindowPushOthersBelow(*this);
@@ -104,7 +104,8 @@ namespace OpenRCT2::Ui::Windows
Formatter ft;
ft.Add(kLandToolMinimumSize);
ft.Add(kLandToolMaximumSize);
- TextInputOpen(WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3);
+ TextInputOpen(
+ WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, 3);
break;
}
case WIDX_SMALL_SCENERY:
@@ -176,7 +177,7 @@ namespace OpenRCT2::Ui::Windows
| (_clearLargeScenery ? (1uLL << WIDX_LARGE_SCENERY) : 0) | (_clearFootpath ? (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));
+ widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
void OnDraw(DrawPixelInfo& dpi) override
@@ -184,8 +185,8 @@ namespace OpenRCT2::Ui::Windows
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() };
+ ScreenCoordsXY screenCoords = { windowPos.x + widgets[WIDX_PREVIEW].midX(),
+ windowPos.y + widgets[WIDX_PREVIEW].midY() };
if (gLandToolSize > kLandToolMaximumSizeWithSprite)
{
auto ft = Formatter();
@@ -200,8 +201,8 @@ namespace OpenRCT2::Ui::Windows
{
auto ft = Formatter();
ft.Add(_clearSceneryCost);
- screenCoords.x = window_clear_scenery_widgets[WIDX_PREVIEW].midX() + windowPos.x;
- screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27;
+ screenCoords.x = widgets[WIDX_PREVIEW].midX() + windowPos.x;
+ screenCoords.y = widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27;
DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE });
}
}
@@ -307,7 +308,8 @@ namespace OpenRCT2::Ui::Windows
if (_clearSceneryCost != cost)
{
_clearSceneryCost = cost;
- WindowInvalidateByClass(WindowClass::ClearScenery);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateByClass(WindowClass::ClearScenery);
}
}
@@ -341,13 +343,16 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_BACKGROUND:
- if (WindowFindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
+ {
+ auto* windowMgr = GetWindowManager();
+ if (windowMgr->FindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
{
auto action = GetClearAction();
GameActions::Execute(&action);
gCurrentToolId = Tool::Bulldozer;
}
break;
+ }
}
}
@@ -376,7 +381,8 @@ namespace OpenRCT2::Ui::Windows
WindowBase* ClearSceneryOpen()
{
- return WindowFocusOrCreate(
+ auto* windowMgr = GetWindowManager();
+ return windowMgr->FocusOrCreate(
WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
}
diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp
index 8392d986fc..3cfb7b9bef 100644
--- a/src/openrct2-ui/windows/CustomCurrency.cpp
+++ b/src/openrct2-ui/windows/CustomCurrency.cpp
@@ -10,7 +10,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
namespace OpenRCT2::Ui::Windows
{
@@ -42,10 +43,9 @@ namespace OpenRCT2::Ui::Windows
static Widget window_custom_currency_widgets[] = {
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
MakeSpinnerWidgets({100, 30}, {101, 11}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_CURRENCY_FORMAT), // NB: 3 widgets
- MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, STR_EMPTY ),
+ MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, kStringIdEmpty ),
MakeWidget ({220, 50}, {131, 11}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
MakeWidget ({339, 51}, { 11, 9}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
- kWidgetsEnd,
};
// clang-format on
@@ -54,7 +54,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = window_custom_currency_widgets;
+ SetWidgets(window_custom_currency_widgets);
hold_down_widgets = (1uLL << WIDX_RATE_UP) | (1uLL << WIDX_RATE_DOWN);
WindowInitScrollWidgets(*this);
colours[0] = COLOUR_LIGHT_BROWN;
@@ -65,6 +65,7 @@ namespace OpenRCT2::Ui::Windows
void OnMouseDown(WidgetIndex widgetIndex) override
{
auto* widget = &widgets[widgetIndex - 1];
+ auto* windowMgr = Ui::GetWindowManager();
switch (widgetIndex)
{
@@ -75,7 +76,7 @@ namespace OpenRCT2::Ui::Windows
CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate += 1;
Config::Get().general.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate;
Config::Save();
- WindowInvalidateAll();
+ windowMgr->InvalidateAll();
break;
case WIDX_RATE_DOWN:
if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate > 1)
@@ -83,7 +84,7 @@ namespace OpenRCT2::Ui::Windows
CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate -= 1;
Config::Get().general.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate;
Config::Save();
- WindowInvalidateAll();
+ windowMgr->InvalidateAll();
}
break;
case WIDX_AFFIX_DROPDOWN_BUTTON:
@@ -149,7 +150,8 @@ namespace OpenRCT2::Ui::Windows
Config::Get().general.CustomCurrencyAffix = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode;
Config::Save();
- WindowInvalidateAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->InvalidateAll();
}
}
@@ -158,7 +160,7 @@ namespace OpenRCT2::Ui::Windows
if (text.empty())
return;
- int32_t rate;
+ auto* windowMgr = Ui::GetWindowManager();
switch (widgetIndex)
{
@@ -171,18 +173,19 @@ namespace OpenRCT2::Ui::Windows
.symbol_unicode;
Config::Save();
- WindowInvalidateAll();
+
+ windowMgr->InvalidateAll();
break;
case WIDX_RATE:
const auto res = String::Parse(text);
if (res.has_value())
{
- rate = res.value();
+ int32_t rate = res.value();
CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate = rate;
Config::Get().general.CustomCurrencyRate = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate;
Config::Save();
- WindowInvalidateAll();
+ windowMgr->InvalidateAll();
}
break;
}
@@ -208,15 +211,12 @@ namespace OpenRCT2::Ui::Windows
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 };
+ screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_SYMBOL_TEXT].left + 1, widgets[WIDX_SYMBOL_TEXT].top };
DrawText(dpi, screenCoords, { colours[1] }, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode);
auto drawPos = windowPos
- + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1,
- window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top };
+ + ScreenCoordsXY{ widgets[WIDX_AFFIX_DROPDOWN].left + 1, widgets[WIDX_AFFIX_DROPDOWN].top };
StringId stringId = (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix)
? STR_PREFIX
: STR_SUFFIX;
@@ -231,6 +231,7 @@ namespace OpenRCT2::Ui::Windows
WindowBase* CustomCurrencyOpen()
{
- return WindowFocusOrCreate(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
+ auto* windowMgr = GetWindowManager();
+ return windowMgr->FocusOrCreate(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 50bdd1a302..cb015859e5 100644
--- a/src/openrct2-ui/windows/DebugPaint.cpp
+++ b/src/openrct2-ui/windows/DebugPaint.cpp
@@ -8,7 +8,7 @@
*****************************************************************************/
#include
-#include
+#include
#include
#include
#include
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
namespace OpenRCT2::Ui::Windows
{
@@ -34,7 +35,7 @@ namespace OpenRCT2::Ui::Windows
constexpr int32_t WINDOW_HEIGHT = 8 + (15 * 6) + 8;
// clang-format off
- static Widget window_debug_paint_widgets[] = {
+ static constexpr Widget window_debug_paint_widgets[] = {
MakeWidget({0, 0}, {WINDOW_WIDTH, WINDOW_HEIGHT}, WindowWidgetType::Frame, WindowColour::Primary ),
MakeWidget({8, 8 + 15 * 0}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_WIDE_PATHS ),
MakeWidget({8, 8 + 15 * 1}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_BLOCKED_TILES ),
@@ -42,7 +43,6 @@ namespace OpenRCT2::Ui::Windows
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 ),
MakeWidget({8, 8 + 15 * 5}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_STABLE_SORT ),
- kWidgetsEnd,
};
// clang-format on
@@ -54,7 +54,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = window_debug_paint_widgets;
+ SetWidgets(window_debug_paint_widgets);
InitScrollWidgets();
WindowPushOthersBelow(*this);
@@ -154,7 +154,8 @@ namespace OpenRCT2::Ui::Windows
WindowBase* DebugPaintOpen()
{
- auto* window = WindowFocusOrCreate(
+ auto* windowMgr = GetWindowManager();
+ auto* window = windowMgr->FocusOrCreate(
WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT,
WF_STICK_TO_FRONT | WF_TRANSPARENT);
diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp
index cec052183d..adfb72ec54 100644
--- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp
+++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp
@@ -8,13 +8,13 @@
*****************************************************************************/
#include
-#include
-#include
+#include
#include
#include
#include
#include
#include
+#include
#include
#include
@@ -33,12 +33,11 @@ namespace OpenRCT2::Ui::Windows
};
// clang-format off
- static Widget window_ride_demolish_widgets[] =
+ static constexpr 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),
- kWidgetsEnd,
};
// clang-format on
@@ -55,7 +54,7 @@ namespace OpenRCT2::Ui::Windows
void OnOpen() override
{
- widgets = window_ride_demolish_widgets;
+ SetWidgets(window_ride_demolish_widgets);
WindowInitScrollWidgets(*this);
}
@@ -102,20 +101,21 @@ namespace OpenRCT2::Ui::Windows
WindowBase* RideDemolishPromptOpen(const Ride& ride)
{
- WindowBase* w;
- DemolishRidePromptWindow* newWindow;
+ auto* windowMgr = GetWindowManager();
+ auto* w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
- w = WindowFindByClass(WindowClass::DemolishRidePrompt);
+ DemolishRidePromptWindow* newWindow;
if (w != nullptr)
{
auto windowPos = w->windowPos;
- WindowClose(*w);
- newWindow = WindowCreate(
+ windowMgr->Close(*w);
+
+ newWindow = windowMgr->Create(
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
}
else
{
- newWindow = WindowCreate(
+ newWindow = windowMgr->Create(
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
}
diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp
index 34a87d4819..354f6c84a2 100644
--- a/src/openrct2-ui/windows/Dropdown.cpp
+++ b/src/openrct2-ui/windows/Dropdown.cpp
@@ -21,13 +21,14 @@
#include
#include
#include
+#include
namespace OpenRCT2::Ui::Windows
{
- constexpr int32_t DROPDOWN_ITEM_HEIGHT = 12;
- constexpr int32_t DROPDOWN_ITEM_HEIGHT_TOUCH = 24;
+ constexpr int32_t kDropdownItemHeight = 12;
+ constexpr int32_t kDropdownItemHeightTouch = 24;
- static constexpr std::array _appropriateImageDropdownItemsPerRow = {
+ static constexpr std::array kAppropriateImageDropdownItemsPerRow = {
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
@@ -41,14 +42,13 @@ namespace OpenRCT2::Ui::Windows
WIDX_BACKGROUND,
};
- static Widget window_dropdown_widgets[] = {
+ static constexpr Widget kWindowDropdownWidgets[] = {
MakeWidget({ 0, 0 }, { 1, 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary),
- kWidgetsEnd,
};
int32_t gDropdownNumItems;
- Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize];
- static ImageId _dropdownItemsImages[Dropdown::ItemsMaxSize];
+ Dropdown::Item gDropdownItems[Dropdown::kItemsMaxSize];
+ static ImageId _dropdownItemsImages[Dropdown::kItemsMaxSize];
bool gDropdownIsColour;
int32_t gDropdownLastColourHover;
int32_t gDropdownHighlightedIndex;
@@ -75,7 +75,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = window_dropdown_widgets;
+ SetWidgets(kWindowDropdownWidgets);
// Input state
gDropdownHighlightedIndex = -1;
@@ -87,7 +87,7 @@ namespace OpenRCT2::Ui::Windows
static int32_t GetDefaultRowHeight()
{
- return Config::Get().interface.EnlargedUi ? DROPDOWN_ITEM_HEIGHT_TOUCH : DROPDOWN_ITEM_HEIGHT;
+ return Config::Get().interface.EnlargedUi ? kDropdownItemHeightTouch : kDropdownItemHeight;
}
static int32_t GetAdditionalRowPadding()
@@ -113,9 +113,9 @@ namespace OpenRCT2::Ui::Windows
if (gDropdownItems[i].IsSeparator())
{
- const ScreenCoordsXY leftTop = screenCoords + ScreenCoordsXY{ 0, (ItemHeight / 2) };
- const ScreenCoordsXY rightBottom = leftTop + ScreenCoordsXY{ ItemWidth - 1, 0 };
- const ScreenCoordsXY shadowOffset{ 0, 1 };
+ const auto leftTop = screenCoords + ScreenCoordsXY{ 2, (ItemHeight / 2) - 1 };
+ const auto rightBottom = leftTop + ScreenCoordsXY{ ItemWidth - 4, 0 };
+ const auto shadowOffset = ScreenCoordsXY{ 0, 1 };
if (colours[0].hasFlag(ColourFlag::translucent))
{
@@ -141,32 +141,33 @@ namespace OpenRCT2::Ui::Windows
}
StringId item = gDropdownItems[i].Format;
- if (item == Dropdown::FormatLandPicker || item == Dropdown::FormatColourPicker)
+ if (item == Dropdown::kFormatLandPicker || item == Dropdown::kFormatColourPicker)
{
// Image item
auto image = UseImages ? _dropdownItemsImages[i]
: ImageId(static_cast(gDropdownItems[i].Args));
- if (item == Dropdown::FormatColourPicker && highlightedIndex == i)
+ if (item == Dropdown::kFormatColourPicker && highlightedIndex == i)
image = image.WithIndexOffset(1);
GfxDrawSprite(dpi, image, screenCoords);
}
else
{
// Text item
- if (i < Dropdown::ItemsMaxSize && Dropdown::IsChecked(i))
+ if (i < Dropdown::kItemsMaxSize && Dropdown::IsChecked(i))
item++;
// Calculate colour
ColourWithFlags colour = { colours[0].colour };
if (i == highlightedIndex)
colour.colour = COLOUR_WHITE;
- if (i < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(i))
+ if (i < Dropdown::kItemsMaxSize && Dropdown::IsDisabled(i))
colour = { colours[0].colour, EnumToFlag(ColourFlag::inset) };
// Draw item string
auto yOffset = GetAdditionalRowPadding();
Formatter ft(reinterpret_cast(&gDropdownItems[i].Args));
- DrawTextEllipsised(dpi, { screenCoords.x, screenCoords.y + yOffset }, width - 5, item, ft, { colour });
+ DrawTextEllipsised(
+ dpi, { screenCoords.x + 2, screenCoords.y + yOffset }, width - 7, item, ft, { colour });
}
}
}
@@ -182,23 +183,24 @@ namespace OpenRCT2::Ui::Windows
}
void SetTextItems(
- const ScreenCoordsXY& screenPos, int32_t extraY, ColourWithFlags colour, uint8_t customHeight, uint8_t txtFlags,
- size_t numItems, int32_t itemWidth)
+ const ScreenCoordsXY& screenPos, int32_t extraY, ColourWithFlags colour, uint8_t customItemHeight, uint8_t txtFlags,
+ size_t numItems, int32_t itemWidth, int32_t numRowsPerColumn)
{
// Set and calculate num items, rows and columns
- ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : GetDefaultRowHeight();
+ ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customItemHeight : GetDefaultRowHeight();
+
gDropdownNumItems = static_cast(numItems);
- // There must always be at least one column to prevent dividing by zero
- if (gDropdownNumItems <= 1)
+ if (gDropdownNumItems > 1)
{
- NumRows = 1;
- NumColumns = 1;
+ int32_t numAvailableRows = std::max(1, getSpaceUntilBottom(screenPos, extraY) / ItemHeight);
+ NumRows = std::min({ gDropdownNumItems, numAvailableRows, numRowsPerColumn });
+ NumColumns = (gDropdownNumItems + NumRows - 1) / NumRows;
}
else
{
- const int32_t numAvailableRows = std::max(1, getSpaceUntilBottom(screenPos, extraY) / ItemHeight);
- NumRows = std::min(numAvailableRows, gDropdownNumItems);
- NumColumns = (gDropdownNumItems + NumRows - 1) / NumRows;
+ // There must always be at least one column to prevent dividing by zero
+ NumRows = 1;
+ NumColumns = 1;
}
ItemWidth = itemWidth;
@@ -224,6 +226,7 @@ namespace OpenRCT2::Ui::Windows
ItemWidth = itemWidth;
ItemHeight = itemHeight;
gDropdownNumItems = numItems;
+
// There must always be at least one column and row to prevent dividing by zero
if (gDropdownNumItems == 0)
{
@@ -295,8 +298,8 @@ namespace OpenRCT2::Ui::Windows
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;
+ widgets[WIDX_BACKGROUND].right = ddWidth;
+ widgets[WIDX_BACKGROUND].bottom = ddHeight;
Invalidate();
width = ddWidth + 1;
@@ -318,21 +321,22 @@ namespace OpenRCT2::Ui::Windows
* @param colour (al)
*/
void WindowDropdownShowText(
- const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags, size_t num_items)
+ const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags, size_t num_items,
+ size_t prefRowsPerColumn)
{
- int32_t string_width, max_string_width;
char buffer[256];
// Calculate the longest string width
- max_string_width = 0;
+ int32_t 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);
+ int32_t 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);
+ WindowDropdownShowTextCustomWidth(
+ screenPos, extray, colour, 0, flags, num_items, max_string_width + 3, prefRowsPerColumn);
}
/**
@@ -345,11 +349,11 @@ namespace OpenRCT2::Ui::Windows
* @param flags (bh)
* @param num_items (bx)
* @param colour (al)
- * @param custom_height (ah) requires flag set as well
+ * @param customItemHeight (ah) requires flag set as well
*/
void WindowDropdownShowTextCustomWidth(
- const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t custom_height, uint8_t flags,
- size_t num_items, int32_t width)
+ const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t customItemHeight, uint8_t flags,
+ size_t num_items, int32_t width, size_t prefRowsPerColumn)
{
InputSetFlag(static_cast(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
if (flags & Dropdown::Flag::StayOpen || Config::Get().interface.TouchEnhancements)
@@ -358,10 +362,12 @@ namespace OpenRCT2::Ui::Windows
WindowDropdownClose();
// Create the window (width/height position are set later)
- auto* w = WindowCreate(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT);
+ auto* windowMgr = GetWindowManager();
+ auto* w = windowMgr->Create(WindowClass::Dropdown, width, customItemHeight, WF_STICK_TO_FRONT);
if (w != nullptr)
{
- w->SetTextItems(screenPos, extray, colour, custom_height, flags, num_items, width);
+ auto numRowsPerColumn = prefRowsPerColumn > 0 ? static_cast(prefRowsPerColumn) : Dropdown::kItemsMaxSize;
+ w->SetTextItems(screenPos, extray, colour, customItemHeight, flags, num_items, width, numRowsPerColumn);
}
}
@@ -391,7 +397,8 @@ namespace OpenRCT2::Ui::Windows
WindowDropdownClose();
// Create the window (width/height position are set later)
- auto* w = WindowCreate(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
+ auto* windowMgr = GetWindowManager();
+ auto* w = windowMgr->Create(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
if (w != nullptr)
{
w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns);
@@ -400,7 +407,8 @@ namespace OpenRCT2::Ui::Windows
void WindowDropdownClose()
{
- WindowCloseByClass(WindowClass::Dropdown);
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::Dropdown);
}
/**
@@ -417,73 +425,71 @@ namespace OpenRCT2::Ui::Windows
return -1;
}
- // clang-format off
-// colour_t ordered for use in color dropdown
-static constexpr colour_t kColoursDropdownOrder[] = {
- COLOUR_BLACK,
- COLOUR_SATURATED_RED,
- COLOUR_DARK_ORANGE,
- COLOUR_DARK_YELLOW,
- COLOUR_GRASS_GREEN_DARK,
- COLOUR_SATURATED_GREEN,
- COLOUR_AQUA_DARK,
- COLOUR_DARK_BLUE,
- COLOUR_SATURATED_PURPLE_DARK,
+ // colour_t ordered for use in color dropdown
+ static constexpr colour_t kColoursDropdownOrder[] = {
+ COLOUR_BLACK,
+ COLOUR_SATURATED_RED,
+ COLOUR_DARK_ORANGE,
+ COLOUR_DARK_YELLOW,
+ COLOUR_GRASS_GREEN_DARK,
+ COLOUR_SATURATED_GREEN,
+ COLOUR_AQUA_DARK,
+ COLOUR_DARK_BLUE,
+ COLOUR_SATURATED_PURPLE_DARK,
- COLOUR_GREY,
- COLOUR_BRIGHT_RED,
- COLOUR_LIGHT_ORANGE,
- COLOUR_YELLOW,
- COLOUR_MOSS_GREEN,
- COLOUR_BRIGHT_GREEN,
- COLOUR_TEAL,
- COLOUR_LIGHT_BLUE,
- COLOUR_BRIGHT_PURPLE,
+ COLOUR_GREY,
+ COLOUR_BRIGHT_RED,
+ COLOUR_LIGHT_ORANGE,
+ COLOUR_YELLOW,
+ COLOUR_MOSS_GREEN,
+ COLOUR_BRIGHT_GREEN,
+ COLOUR_TEAL,
+ COLOUR_LIGHT_BLUE,
+ COLOUR_BRIGHT_PURPLE,
- COLOUR_WHITE,
- COLOUR_LIGHT_PINK,
- COLOUR_ORANGE_LIGHT,
- COLOUR_BRIGHT_YELLOW,
- COLOUR_GRASS_GREEN_LIGHT,
- COLOUR_SATURATED_GREEN_LIGHT,
- COLOUR_AQUAMARINE,
- COLOUR_ICY_BLUE,
- COLOUR_SATURATED_PURPLE_LIGHT,
+ COLOUR_WHITE,
+ COLOUR_LIGHT_PINK,
+ COLOUR_ORANGE_LIGHT,
+ COLOUR_BRIGHT_YELLOW,
+ COLOUR_GRASS_GREEN_LIGHT,
+ COLOUR_SATURATED_GREEN_LIGHT,
+ COLOUR_AQUAMARINE,
+ COLOUR_ICY_BLUE,
+ COLOUR_SATURATED_PURPLE_LIGHT,
- COLOUR_DULL_BROWN_DARK,
- COLOUR_BORDEAUX_RED_DARK,
- COLOUR_TAN_DARK,
- COLOUR_SATURATED_BROWN,
- COLOUR_DARK_OLIVE_DARK,
- COLOUR_OLIVE_DARK,
- COLOUR_DULL_GREEN_DARK,
- COLOUR_DARK_PURPLE,
- COLOUR_DARK_PINK,
+ COLOUR_DULL_BROWN_DARK,
+ COLOUR_BORDEAUX_RED_DARK,
+ COLOUR_TAN_DARK,
+ COLOUR_SATURATED_BROWN,
+ COLOUR_DARK_OLIVE_DARK,
+ COLOUR_OLIVE_DARK,
+ COLOUR_DULL_GREEN_DARK,
+ COLOUR_DARK_PURPLE,
+ COLOUR_DARK_PINK,
- COLOUR_DARK_BROWN,
- COLOUR_BORDEAUX_RED,
- COLOUR_SALMON_PINK,
- COLOUR_LIGHT_BROWN,
- COLOUR_DARK_OLIVE_GREEN,
- COLOUR_OLIVE_GREEN,
- COLOUR_DARK_GREEN,
- COLOUR_LIGHT_PURPLE,
- COLOUR_BRIGHT_PINK,
+ COLOUR_DARK_BROWN,
+ COLOUR_BORDEAUX_RED,
+ COLOUR_SALMON_PINK,
+ COLOUR_LIGHT_BROWN,
+ COLOUR_DARK_OLIVE_GREEN,
+ COLOUR_OLIVE_GREEN,
+ COLOUR_DARK_GREEN,
+ COLOUR_LIGHT_PURPLE,
+ COLOUR_BRIGHT_PINK,
- COLOUR_DULL_BROWN_LIGHT,
- COLOUR_BORDEAUX_RED_LIGHT,
- COLOUR_TAN_LIGHT,
- COLOUR_SATURATED_BROWN_LIGHT,
- COLOUR_DARK_OLIVE_LIGHT,
- COLOUR_OLIVE_LIGHT,
- COLOUR_DULL_GREEN_LIGHT,
- COLOUR_DULL_PURPLE_LIGHT,
- COLOUR_MAGENTA_LIGHT,
+ COLOUR_DULL_BROWN_LIGHT,
+ COLOUR_BORDEAUX_RED_LIGHT,
+ COLOUR_TAN_LIGHT,
+ COLOUR_SATURATED_BROWN_LIGHT,
+ COLOUR_DARK_OLIVE_LIGHT,
+ COLOUR_OLIVE_LIGHT,
+ COLOUR_DULL_GREEN_LIGHT,
+ COLOUR_DULL_PURPLE_LIGHT,
+ COLOUR_MAGENTA_LIGHT,
- COLOUR_INVISIBLE,
- COLOUR_VOID
-};
- // clang-format on
+ COLOUR_INVISIBLE,
+ COLOUR_VOID,
+ };
colour_t ColourDropDownIndexToColour(uint8_t ddidx)
{
@@ -511,7 +517,7 @@ static constexpr colour_t kColoursDropdownOrder[] = {
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].Format = Dropdown::kFormatColourPicker;
Dropdown::SetImage(i, imageId);
}
@@ -530,8 +536,8 @@ static constexpr colour_t kColoursDropdownOrder[] = {
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))];
+ return kAppropriateImageDropdownItemsPerRow[std::min(
+ numItems, static_cast(std::size(kAppropriateImageDropdownItemsPerRow) - 1))];
}
} // namespace OpenRCT2::Ui::Windows
diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp
index 3d66604bf8..8d22ece9f8 100644
--- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp
+++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp
@@ -10,7 +10,7 @@
#include "../interface/Theme.h"
#include
-#include
+#include
#include
#include
#include
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -38,12 +39,11 @@ namespace OpenRCT2::Ui::Windows
};
// clang-format off
- static Widget _editorBottomToolbarWidgets[] = {
+ static constexpr Widget kEditorBottomToolbarWidgets[] = {
MakeWidget({ 0, 0}, {200, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary),
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),
- kWidgetsEnd,
};
// clang-format on
@@ -52,7 +52,7 @@ namespace OpenRCT2::Ui::Windows
private:
using FuncPtr = void (EditorBottomToolbarWindow::*)() const;
- static constexpr StringId _editorStepNames[] = {
+ static constexpr StringId kEditorStepNames[] = {
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,
@@ -62,7 +62,7 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = _editorBottomToolbarWidgets;
+ SetWidgets(kEditorBottomToolbarWidgets);
InitScrollWidgets();
SetAllSceneryItemsInvented();
@@ -105,7 +105,7 @@ namespace OpenRCT2::Ui::Windows
}
else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER))
{
- if (GetNumFreeEntities() != MAX_ENTITIES || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)
+ if (GetNumFreeEntities() != kMaxEntities || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)
{
HidePreviousStepButton();
}
@@ -141,28 +141,32 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
{
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
- || (GetNumFreeEntities() == MAX_ENTITIES && !(gameState.Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)))
+ || (GetNumFreeEntities() == kMaxEntities && !(gameState.Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)))
{
- ((this)->*(_previousButtonMouseUp[EnumValue(gameState.EditorStep)]))();
+ ((this)->*(kPreviousButtonMouseUp[EnumValue(gameState.EditorStep)]))();
}
}
else if (widgetIndex == WIDX_NEXT_STEP_BUTTON)
{
- ((this)->*(_nextButtonMouseUp[EnumValue(gameState.EditorStep)]))();
+ ((this)->*(kNextButtonMouseUp[EnumValue(gameState.EditorStep)]))();
}
}
private:
void JumpBackToObjectSelection() const
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
+
GetGameState().EditorStep = EditorStep::ObjectSelection;
GfxInvalidateScreen();
}
void JumpBackToLandscapeEditor() const
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
+
SetAllSceneryItemsInvented();
WindowScenerySetDefaultPlacementConfiguration();
GetGameState().EditorStep = EditorStep::LandscapeEditor;
@@ -172,7 +176,9 @@ namespace OpenRCT2::Ui::Windows
void JumpBackToInventionListSetUp() const
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
+
ContextOpenWindow(WindowClass::EditorInventionList);
GetGameState().EditorStep = EditorStep::InventionsListSetUp;
GfxInvalidateScreen();
@@ -180,7 +186,9 @@ namespace OpenRCT2::Ui::Windows
void JumpBackToOptionsSelection() const
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
+
ContextOpenWindow(WindowClass::EditorScenarioOptions);
GetGameState().EditorStep = EditorStep::OptionsSelection;
GfxInvalidateScreen();
@@ -208,7 +216,8 @@ namespace OpenRCT2::Ui::Windows
auto [checksPassed, errorString] = Editor::CheckPark();
if (checksPassed)
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
ContextOpenWindow(WindowClass::EditorInventionList);
GetGameState().EditorStep = EditorStep::InventionsListSetUp;
}
@@ -222,7 +231,9 @@ namespace OpenRCT2::Ui::Windows
void JumpForwardToOptionsSelection() const
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
+
ContextOpenWindow(WindowClass::EditorScenarioOptions);
GetGameState().EditorStep = EditorStep::OptionsSelection;
GfxInvalidateScreen();
@@ -230,7 +241,9 @@ namespace OpenRCT2::Ui::Windows
void JumpForwardToObjectiveSelection() const
{
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
+
ContextOpenWindow(WindowClass::EditorObjectiveOptions);
GetGameState().EditorStep = EditorStep::ObjectiveSelection;
GfxInvalidateScreen();
@@ -247,7 +260,8 @@ namespace OpenRCT2::Ui::Windows
return;
}
- WindowCloseAll();
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseAll();
auto intent = Intent(WindowClass::Loadsave);
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO);
intent.PutExtra(INTENT_EXTRA_PATH, gameState.ScenarioName);
@@ -296,7 +310,7 @@ namespace OpenRCT2::Ui::Windows
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];
+ StringId stringId = kEditorStepNames[EnumValue(GetGameState().EditorStep) - 1];
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
stringId = STR_EDITOR_STEP_OBJECT_SELECTION;
@@ -335,7 +349,7 @@ namespace OpenRCT2::Ui::Windows
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];
+ StringId stringId = kEditorStepNames[EnumValue(GetGameState().EditorStep) + 1];
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER;
@@ -349,11 +363,11 @@ namespace OpenRCT2::Ui::Windows
int16_t stateY = height - 0x0C + windowPos.y;
auto colour = colours[2].withFlag(ColourFlag::translucent, false).withFlag(ColourFlag::withOutline, true);
DrawTextBasic(
- dpi, { stateX, stateY }, _editorStepNames[EnumValue(GetGameState().EditorStep)], {},
+ dpi, { stateX, stateY }, kEditorStepNames[EnumValue(GetGameState().EditorStep)], {},
{ colour, TextAlignment::CENTRE });
}
- static constexpr FuncPtr _previousButtonMouseUp[] = {
+ static constexpr FuncPtr kPreviousButtonMouseUp[] = {
nullptr,
&EditorBottomToolbarWindow::JumpBackToObjectSelection,
&EditorBottomToolbarWindow::JumpBackToLandscapeEditor,
@@ -364,7 +378,7 @@ namespace OpenRCT2::Ui::Windows
nullptr,
};
- static constexpr FuncPtr _nextButtonMouseUp[] = {
+ static constexpr FuncPtr kNextButtonMouseUp[] = {
&EditorBottomToolbarWindow::JumpForwardFromObjectSelection,
&EditorBottomToolbarWindow::JumpForwardToInventionListSetUp,
&EditorBottomToolbarWindow::JumpForwardToOptionsSelection,
@@ -382,7 +396,8 @@ namespace OpenRCT2::Ui::Windows
*/
WindowBase* EditorBottomToolbarOpen()
{
- auto* window = WindowCreate(
+ auto* windowMgr = GetWindowManager();
+ auto* window = windowMgr->Create(
WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32,
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp
index dbb627430c..30754c1219 100644
--- a/src/openrct2-ui/windows/EditorInventionsList.cpp
+++ b/src/openrct2-ui/windows/EditorInventionsList.cpp
@@ -10,7 +10,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
namespace OpenRCT2::Ui::Windows
@@ -51,7 +52,7 @@ namespace OpenRCT2::Ui::Windows
};
// clang-format off
- static Widget _inventionListWidgets[] = {
+ static constexpr Widget _inventionListWidgets[] = {
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
MakeWidget({ 0, 43}, {600, 357}, WindowWidgetType::Resize, WindowColour::Secondary ),
MakeTab ({ 3, 17} ),
@@ -61,12 +62,10 @@ namespace OpenRCT2::Ui::Windows
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),
- kWidgetsEnd,
};
- static Widget _inventionListDragWidgets[] = {
+ static constexpr Widget _inventionListDragWidgets[] = {
MakeWidget({0, 0}, {150, 14}, WindowWidgetType::ImgBtn, WindowColour::Primary),
- kWidgetsEnd,
};
// clang-format on
@@ -151,7 +150,7 @@ namespace OpenRCT2::Ui::Windows
{
ResearchRidesSetup();
- widgets = _inventionListWidgets;
+ SetWidgets(_inventionListWidgets);
InitScrollWidgets();
selected_tab = 0;
_selectedResearchItem = nullptr;
@@ -217,7 +216,8 @@ namespace OpenRCT2::Ui::Windows
{
frame_no++;
OnPrepareDraw();
- WidgetInvalidate(*this, WIDX_TAB_1);
+
+ InvalidateWidget(WIDX_TAB_1);
if (WindowEditorInventionsListDragGetItem() != nullptr)
return;
@@ -489,7 +489,9 @@ namespace OpenRCT2::Ui::Windows
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* windowMgr = GetWindowManager();
+ WidgetIndex widgetIndex = windowMgr->FindWidgetFromPoint(*this, screenCoords);
+
auto& widget = widgets[widgetIndex];
if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL)
{
@@ -592,7 +594,8 @@ namespace OpenRCT2::Ui::Windows
*/
WindowBase* EditorInventionsListOpen()
{
- return WindowFocusOrCreate(
+ auto* windowMgr = GetWindowManager();
+ return windowMgr->FocusOrCreate(
WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN);
}
#pragma endregion
@@ -606,13 +609,15 @@ namespace OpenRCT2::Ui::Windows
public:
void OnOpen() override
{
- widgets = _inventionListDragWidgets;
+ SetWidgets(_inventionListDragWidgets);
colours[1] = COLOUR_WHITE;
}
CursorID OnCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override
{
- auto* inventionListWindow = static_cast(WindowFindByClass(WindowClass::EditorInventionList));
+ auto* windowMgr = GetWindowManager();
+ auto* inventionListWindow = static_cast(
+ windowMgr->FindByClass(WindowClass::EditorInventionList));
if (inventionListWindow != nullptr)
{
auto res = inventionListWindow->GetResearchItemAt(screenCoords);
@@ -629,7 +634,9 @@ namespace OpenRCT2::Ui::Windows
void OnMoved(const ScreenCoordsXY& screenCoords) override
{
- auto* inventionListWindow = static_cast(WindowFindByClass(WindowClass::EditorInventionList));
+ auto* windowMgr = GetWindowManager();
+ auto* inventionListWindow = static_cast(
+ windowMgr->FindByClass(WindowClass::EditorInventionList));
if (inventionListWindow == nullptr)
{
Close();
@@ -649,7 +656,7 @@ namespace OpenRCT2::Ui::Windows
inventionListWindow->MoveResearchItem(_draggedItem, res->research, res->isInvented);
}
- WindowInvalidateByClass(WindowClass::EditorInventionList);
+ windowMgr->InvalidateByClass(WindowClass::EditorInventionList);
Close();
}
@@ -684,8 +691,9 @@ namespace OpenRCT2::Ui::Windows
static void WindowEditorInventionsListDragOpen(
ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth)
{
- WindowCloseByClass(WindowClass::EditorInventionListDrag);
- auto* wnd = WindowCreate(
+ auto* windowMgr = Ui::GetWindowManager();
+ windowMgr->CloseByClass(WindowClass::EditorInventionListDrag);
+ auto* wnd = windowMgr->Create(
WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
if (wnd != nullptr)
{
@@ -695,7 +703,8 @@ namespace OpenRCT2::Ui::Windows
static const ResearchItem* WindowEditorInventionsListDragGetItem()
{
- auto* wnd = static_cast(WindowFindByClass(WindowClass::EditorInventionListDrag));
+ auto* windowMgr = GetWindowManager();
+ auto* wnd = static_cast