diff --git a/CMakeLists.txt b/CMakeLists.txt index c9bb21cdd4..9a8e0c8b53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,9 +70,9 @@ set(TITLE_SEQUENCE_VERSION "0.4.26") set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip") set(TITLE_SEQUENCE_SHA256 "dabb9787b1576342fca4dd9f64b3f8cfa04a7e6ce9c2bb9610f47b762905c858") -set(OBJECTS_VERSION "1.7.3") +set(OBJECTS_VERSION "1.7.5") set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip") -set(OBJECTS_SHA256 "c81029264578706ed1db88665e12a70a583e71dc4d3eb4db262535d2f0589eab") +set(OBJECTS_SHA256 "c8b9d3039a920f67caf15b09e8312cc4f80d59ed7fe0288625b9ccedef606797") set(OPENSFX_VERSION "1.0.6") set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip") diff --git a/contributors.md b/contributors.md index aa14496663..53cd7ea965 100644 --- a/contributors.md +++ b/contributors.md @@ -15,7 +15,8 @@ Includes all git commit authors. Aliases are GitHub usernames or community nickn * Joshua Jacobs (leicestersquare) - Graphic Artist ## Support team -* Kenton Boadway (Krutonium) - Lead OpenScenarios +* (Kyphii) - Lead OpenScenarios +* Kenton Boadway (Krutonium) - Discord moderation ## Former development team members * Lewis Fox (LRFLEW) @@ -30,6 +31,7 @@ Appreciation for long term contributors to the project having provided substanti * Edward Calver (X7123M3-256) * Kelson Blakewood (spacek531) * (frutiemax) +* (mixiate) ## Special Thanks Appreciation for contributors who have provided substantial work, but are no longer active. @@ -252,6 +254,8 @@ Appreciation for contributors who have provided substantial work, but are no lon * David Sungaila (sungaila) * Garrett Leach (GarrettLeach) * Ruohao (Jater) Xu (jaterx) +* Marcel Vos (MarcelVos96) +* Jonas Doggart ## Toolchain * (Balletie) - macOS diff --git a/data/language/ar-EG.txt b/data/language/ar-EG.txt index d42744b990..3949c3e45a 100644 --- a/data/language/ar-EG.txt +++ b/data/language/ar-EG.txt @@ -32,12 +32,9 @@ STR_0027 :السيارات المتصادمة STR_0028 :سفينة القراصنة STR_0029 :سفينة متأرجحة عكسية STR_0030 :كشك الطعام -STR_0031 :كشك غير معروف (1D) STR_0032 :كشك الشرب -STR_0033 :كشك غير معروف (1F) STR_0034 :متجر STR_0035 :أفعوانية الخيل -STR_0036 :كشك غير معروف (22) STR_0037 :منصة المعلومات STR_0038 :غرفة الإستراحة STR_0039 :عجلة فيريس @@ -83,16 +80,10 @@ STR_0078 :إفعوانية منعطفه حاده معكوسة STR_0079 :السجادة السحرية STR_0080 :رحلة بالغواصة STR_0081 :طوافات النهر -STR_0082 :رحلة غير معروفة (50) STR_0083 :مغامرة -STR_0084 :رحلة غير معروفة (52) -STR_0085 :رحلة غير معروفة (53) -STR_0086 :رحلة غير معروفة (54) -STR_0087 :رحلة غير معروفة (55) STR_0088 :إفعوانية دافعة معكوسة STR_0089 :إفعوانية دائرية مصغرة STR_0090 :رحلة مصغرة -STR_0091 :رحلة غير معروفة (59) STR_0092 :LIM أفعوانية مُطلقة بواسطة STR_0093 :أفعوانية هجينة STR_0094 :أفعوانية سكة حديدية مفردة diff --git a/data/language/ca-ES.txt b/data/language/ca-ES.txt index 945bf385f3..aff7bbf8c5 100644 --- a/data/language/ca-ES.txt +++ b/data/language/ca-ES.txt @@ -32,12 +32,9 @@ STR_0027 :Cotxes de xoc STR_0028 :Vaixell amb balanceig STR_0029 :Vaixell amb balanceig i inversió STR_0030 :Estand de menjar -STR_0031 :Estand desconegut (1D) STR_0032 :Estand de begudes -STR_0033 :Estand desconegut (1F) STR_0034 :Tenda STR_0035 :Cavallets -STR_0036 :Estand desconegut (22) STR_0037 :Quiosc d’informació STR_0038 :Lavabos STR_0039 :Roda de fira @@ -83,16 +80,10 @@ STR_0078 :Forquilla invertida STR_0079 :Catifa màgica STR_0080 :Viatge submarí STR_0081 :Barques soleres -STR_0082 :Atracció desconeguda (50) STR_0083 :Enterprise -STR_0084 :Atracció desconeguda (52) -STR_0085 :Atracció desconeguda (53) -STR_0086 :Atracció desconeguda (54) -STR_0087 :Atracció desconeguda (55) STR_0088 :Muntanya russa d’impuls invers STR_0089 :Minimuntanya russa STR_0090 :La mina -STR_0091 :Atracció desconeguda (59) STR_0092 :Muntanya russa d’impuls LIM STR_0093 :Muntanya russa híbrida STR_0094 :Muntanya russa d’un sol rail @@ -567,7 +558,7 @@ STR_1169 :(Cap) STR_1170 :{STRING} STR_1171 :{RED}Tancada STR_1172 :{YELLOW}{STRINGID} -STR_1173 :Construir camins i cues +STR_1173 :Construeix camins i cues STR_1174 :Hi ha un cartell pel mig. STR_1175 :Això no es pot construir a sobre d’un pendent. STR_1176 :Aquest camí aquí no es pot construir… @@ -3845,3 +3836,6 @@ STR_7001 :Nom de l’atracció STR_7002 :{STRINGID} {STRINGID} STR_7003 :El fitxer d’àudio «{STRING}» està truncat. Mostra esperada de {INT32}, però només n’hi ha {INT32}. Considereu reinstal·lar el RCT2. STR_7004 :Força que es torni a dibuixar +STR_7005 :Dibuixa una àrea de camí +STR_7006 :Dibuixa una vora al voltant de les imatges dels botons +STR_7007 :Tipus d’atracció diff --git a/data/language/cs-CZ.txt b/data/language/cs-CZ.txt index cbbba7e1a2..9459f71a55 100644 --- a/data/language/cs-CZ.txt +++ b/data/language/cs-CZ.txt @@ -32,12 +32,9 @@ STR_0027 :Autodrom STR_0028 :Pirátská loď STR_0029 :Houpající se obrácená loď STR_0030 :Stánek s jídlem -STR_0031 :Neznámý obchod (1D) STR_0032 :Stánek s pitím -STR_0033 :Neznámý obchod (1F) STR_0034 :Obchod STR_0035 :Kolotoč -STR_0036 :Neznámý obchod (22) STR_0037 :Informační kiosek STR_0038 :Toalety STR_0039 :Ruské kolo @@ -83,16 +80,10 @@ STR_0078 :Ostrá zavěšená horská dráha STR_0079 :Kouzelný koberec STR_0080 :Podmořská jízda STR_0081 :Říční vory -STR_0082 :Neznámá atrakce (50) STR_0083 :Loď Enterprise -STR_0084 :Neznámá atrakce (52) -STR_0085 :Neznámá atrakce (53) -STR_0086 :Neznámá atrakce (54) -STR_0087 :Neznámá atrakce (55) STR_0088 :Otočená impulsní dráha STR_0089 :Malá horská dráha STR_0090 :Mini dráha -STR_0091 :Neznámá atrakce (59) STR_0092 :LIM horská dráha STR_0093 :Hybridní horská dráha STR_0094 :Jednokolejná horská dráha @@ -3845,4 +3836,6 @@ STR_7002 :{STRINGID} {STRINGID} STR_7003 :Zvukový soubor ‘{STRING}’ je zkrácený. Očekáván sample {INT32}, avšak pouze {INT32} je dostupných. Zvažte přeinstalování RCT2. STR_7004 :Vynutit překresl. (force redraw) STR_7005 :Stavět cesty v oblasti označené tažením -STR_7006 :Vykreslit okraje tlačítek s obrázky \ No newline at end of file +STR_7006 :Vykreslit okraje tlačítek s obrázky +STR_7007 :Typ atrakce +STR_7008 :Neznámá atrakce ({INT32}) \ No newline at end of file diff --git a/data/language/da-DK.txt b/data/language/da-DK.txt index 5183b13c5d..920523f90b 100644 --- a/data/language/da-DK.txt +++ b/data/language/da-DK.txt @@ -32,12 +32,9 @@ STR_0027 :Radiobiler STR_0028 :Svingende Skib STR_0029 :Svingende Inverteret Skib STR_0030 :Madbod -STR_0031 :Ukendt Bod (1D) STR_0032 :Drikkebod -STR_0033 :Ukendt Bod (1F) STR_0034 :Butik STR_0035 :Karrusel -STR_0036 :Ukendt Bod (22) STR_0037 :Informations Kiosk STR_0038 :Toiletter STR_0039 :Pariserhjul @@ -83,16 +80,10 @@ STR_0078 :Inverteret Hårnåls Rutschebane STR_0079 :Flyvende Tæppe STR_0080 :Ubåds Forlystelse STR_0081 :River Rafts -STR_0082 :Ukendt Forlystelse (50) STR_0083 :Enterprise -STR_0084 :Ukendt Forlystelse (52) -STR_0085 :Ukendt Forlystelse (53) -STR_0086 :Ukendt Forlystelse (54) -STR_0087 :Ukendt Forlystelse (55) STR_0088 :Inverteret Impuls Rutschebane STR_0089 :Mini Rutschebane STR_0090 :Mine Forlystelse -STR_0091 :Ukendt Forlystelse (59) STR_0092 :LIM Accelereret Rutschebane STR_0093 :Hybrid Rutschebane STR_0094 :Enkelt skinde rutchebane diff --git a/data/language/de-DE.txt b/data/language/de-DE.txt index 3ca5780fe4..00a606a774 100644 --- a/data/language/de-DE.txt +++ b/data/language/de-DE.txt @@ -32,12 +32,9 @@ STR_0027 :Autoscooter STR_0028 :Piratenschiff STR_0029 :Schwingendes Überkopfschiff STR_0030 :Imbissstand -STR_0031 :Unbekannter Stand (1D) STR_0032 :Getränkestand -STR_0033 :Unbekannter Stand (1F) STR_0034 :Stand STR_0035 :Karussell -STR_0036 :Stand STR_0037 :Kiosk STR_0038 :Toiletten STR_0039 :Riesenrad @@ -83,16 +80,10 @@ STR_0078 :Umgekehrte Haarnadelbahn STR_0079 :Fliegender Teppich STR_0080 :U-Boot-Fahrt STR_0081 :Floße -STR_0082 :Unbekannte Bahn (50) STR_0083 :Enterprise -STR_0084 :Unbekannte Bahn (52) -STR_0085 :Unbekannte Bahn (53) -STR_0086 :Unbekannte Bahn (54) -STR_0087 :Unbekannte Bahn (55) STR_0088 :Umgekehrte Impuls-Bahn STR_0089 :Miniachterbahn STR_0090 :Minenbahn -STR_0091 :Unbekannte Bahn (59) STR_0092 :LIM-Achterbahn STR_0093 :Hybridachterbahn STR_0094 :Einschienenachterbahn @@ -3836,3 +3827,7 @@ STR_7000 :oder STR_7001 :Fahrgeschäftsname STR_7002 :{STRINGID} {STRINGID} STR_7003 :Die Audiodatei „{STRING}“ ist abgeschnitten. Sample {INT32} erwartet, es sind aber nur {INT32} verfügbar. Ziehen Sie eine Neuinstallation von RCT2 in Betracht. +STR_7004 :Erzwinge Neuzeichnung +STR_7005 :Baue eine Fläche aus Fußwegen +STR_7006 :Zeichne Ränder um Bildknöpfe +STR_7007 :Achterbahntyp diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index ae91bf194e..0102bca7d7 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -32,12 +32,9 @@ STR_0027 :Dodgems STR_0028 :Swinging Ship STR_0029 :Swinging Inverter Ship STR_0030 :Food Stall -STR_0031 :Unknown Stall (1D) STR_0032 :Drink Stall -STR_0033 :Unknown Stall (1F) STR_0034 :Shop STR_0035 :Merry-Go-Round -STR_0036 :Unknown Stall (22) STR_0037 :Information Kiosk STR_0038 :Toilets STR_0039 :Ferris Wheel @@ -83,16 +80,10 @@ STR_0078 :Inverted Hairpin Coaster STR_0079 :Magic Carpet STR_0080 :Submarine Ride STR_0081 :River Rafts -STR_0082 :Unknown Ride (50) STR_0083 :Enterprise -STR_0084 :Unknown Ride (52) -STR_0085 :Unknown Ride (53) -STR_0086 :Unknown Ride (54) -STR_0087 :Unknown Ride (55) STR_0088 :Inverted Impulse Coaster STR_0089 :Mini Roller Coaster STR_0090 :Mine Ride -STR_0091 :Unknown Ride (59) STR_0092 :LIM Launched Roller Coaster STR_0093 :Hybrid Coaster STR_0094 :Single Rail Roller Coaster @@ -3846,3 +3837,4 @@ STR_7004 :Force Redraw STR_7005 :Drag an area of footpath STR_7006 :Draw border around image buttons STR_7007 :Ride Type +STR_7008 :Unknown ride type ({INT32}) diff --git a/data/language/eo-ZZ.txt b/data/language/eo-ZZ.txt index 959192e0a4..71208c0141 100644 --- a/data/language/eo-ZZ.txt +++ b/data/language/eo-ZZ.txt @@ -32,12 +32,9 @@ STR_0027 :Doĝemoj STR_0028 :Svingiĝanta Ŝipo STR_0029 :Svingiĝanta Inversiĝanta Ŝipo STR_0030 :Manĝaĵbudo -STR_0031 :Nekonata Budo (1D) STR_0032 :Trinkaĵbudo -STR_0033 :Nekonata Budo (1F) STR_0034 :Vendejo STR_0035 :Karuselo -STR_0036 :Nekonata Budo (22) STR_0037 :Informokiosko STR_0038 :Necesejo STR_0039 :Spektoradego @@ -83,16 +80,10 @@ STR_0078 :Inversigita Onda Fervojo kun Harpingloformaj Kurboj STR_0079 :Magia Tapiŝo STR_0080 :Submarŝiprajdo STR_0081 :Riverflosoj -STR_0082 :Nekonata Atrakcio (50) STR_0083 :Centrifugilo -STR_0084 :Nekonata Atrakcio (52) -STR_0085 :Nekonata Atrakcio (53) -STR_0086 :Nekonata Atrakcio (54) -STR_0087 :Nekonata Atrakcio (55) STR_0088 :Inversigita Lanĉita Onda Fervojo STR_0089 :Miniatura Onda Fervojo STR_0090 :Minrajdo -STR_0091 :Nekonata Atrakcio (59) STR_0092 :Onda Fervojo Lanĉita per Linearaj Induktaj Motoroj STR_0093 :Hibrida Onda Fervojo STR_0094 :Onda Fervojo kun Unuopa Relo @@ -3841,3 +3832,5 @@ STR_7002 :{STRINGID} {STRINGID} STR_7003 :Sondosiero ‘{STRING}’ estas distranĉita. Atendis sonpecon {INT32}, sed nur {INT32} disponeblas. Konsideru reinstali je RCT2. STR_7004 :Devigi redesegnon STR_7005 :Treni areon de trotuaro +STR_7006 :Desegni borderon ĉirkaŭ bildo-butonoj +STR_7007 :Atrakciotipo diff --git a/data/language/es-ES.txt b/data/language/es-ES.txt index bb97334438..4818e88f7b 100644 --- a/data/language/es-ES.txt +++ b/data/language/es-ES.txt @@ -32,12 +32,9 @@ STR_0027 :Coches de Choque STR_0028 :Barco Pirata STR_0029 :Barco Balancín Invertido STR_0030 :Puesto de comida -STR_0031 :Puesto Desconocido (1D) STR_0032 :Puesto de Bebidas -STR_0033 :Puesto Desconocido (1F) STR_0034 :Tienda STR_0035 :Tiovivo -STR_0036 :Puesto Desconocido (22) STR_0037 :Quiosco de Información STR_0038 :Baños STR_0039 :Rueda Gigante @@ -83,16 +80,10 @@ STR_0078 :Horquilla invertida STR_0079 :Alfombra Mágica STR_0080 :Viaje Submarino STR_0081 :Balsas de Río -STR_0082 :Atracc. Desconocida (50) STR_0083 :Enterprise -STR_0084 :Atracc. Desconocida (52) -STR_0085 :Atracc. Desconocida (53) -STR_0086 :Atracc. Desconocida (54) -STR_0087 :Atracc. Desconocida (55) 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 acelerada por LIM STR_0093 :Montaña Rusa Híbrida STR_0094 :Montaña Rusa de un solo carril diff --git a/data/language/fi-FI.txt b/data/language/fi-FI.txt index daa597ce76..b8e1c9491e 100644 --- a/data/language/fi-FI.txt +++ b/data/language/fi-FI.txt @@ -32,12 +32,9 @@ STR_0027 :Törmäilyautot STR_0028 :Merirosvolaiva STR_0029 :Kieppuva merirosvolaiva STR_0030 :Ruokakoju -STR_0031 :Tuntematon koju (1D) STR_0032 :Juomakoju -STR_0033 :Tuntematon koju (1F) STR_0034 :Kauppa STR_0035 :Karuselli -STR_0036 :Tuntematon koju (22) STR_0037 :Infokioski STR_0038 :Vessa STR_0039 :Maailmanpyörä @@ -83,17 +80,11 @@ STR_0078 :Käänteinen hiusneularata STR_0079 :Taikamatto STR_0080 :Sukellusveneajelu STR_0081 :Jokilautat -STR_0082 :Tuntematon laite (50) # 0083 is a name, and can't be translated. The ride itself was named after USS Enterprise from star trek, see wikipedia. STR_0083 :Enterprise -STR_0084 :Tuntematon laite (52) -STR_0085 :Tuntematon laite (53) -STR_0086 :Tuntematon laite (54) -STR_0087 :Tuntematon laite (55) STR_0088 :Käänteinen impulssirata STR_0089 :Minivuoristorata STR_0090 :Kaivosajelu -STR_0091 :Tuntematon laite (59) STR_0092 :Laukaisuvuoristorata STR_0093 :Hybridivuoristorata STR_0094 :Yksikiskoinen vuoristorata diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt index 7b0292da80..88a01d4a58 100644 --- a/data/language/fr-FR.txt +++ b/data/language/fr-FR.txt @@ -34,12 +34,9 @@ STR_0027 :Autos tamponneuses STR_0028 :Bateau pirate STR_0029 :Bateau renverseur STR_0030 :Stand de nourriture -STR_0031 :Stand inconnu (1D) STR_0032 :Stand de boissons -STR_0033 :Stand inconnu (1F) STR_0034 :Boutique STR_0035 :Carrousel -STR_0036 :Stand inconnu (22) STR_0037 :Kiosque d’information STR_0038 :Toilettes STR_0039 :Grande roue @@ -85,16 +82,10 @@ STR_0078 :Epingle à cheveux inversée STR_0079 :Tapis volant STR_0080 :Balade sous-marine STR_0081 :Radeau -STR_0082 :Manège Inconnu (50) STR_0083 :Entreprise -STR_0084 :Manège Inconnu (52) -STR_0085 :Manège Inconnu (53) -STR_0086 :Manège Inconnu (54) -STR_0087 :Manège Inconnu (55) STR_0088 :Impulsion inversée STR_0089 :Mini-montagnes russes STR_0090 :Mineur -STR_0091 :Manège Inconnu (59) STR_0092 :Moteur à induction linéaire STR_0093 :Montagnes russes hybrides STR_0094 :Montagnes russes à rail unique diff --git a/data/language/gl-ES.txt b/data/language/gl-ES.txt index 561bb8bf39..144166c637 100644 --- a/data/language/gl-ES.txt +++ b/data/language/gl-ES.txt @@ -32,12 +32,9 @@ STR_0027 :Coches de choque STR_0028 :Barco pirata STR_0029 :Barco basculante invertido STR_0030 :posto de comida -STR_0031 :Posto descoñecido (1D) STR_0032 :Posto de bebidas -STR_0033 :Posto descoñecido (1F) STR_0034 :Tenda STR_0035 :Carrusel -STR_0036 :Posto descoñecido (22) STR_0037 :Quiosco de información STR_0038 :Aseos STR_0039 :Nora @@ -83,16 +80,10 @@ STR_0078 :Montaña Rusa de Prendedor invertido STR_0079 :Alfombra máxica STR_0080 :Viaxe submarina STR_0081 :Balsas fluviais -STR_0082 :Atracción Descoñecida (50) STR_0083 :Enterprise -STR_0084 :Atracción Descoñecida (52) -STR_0085 :Atracción Descoñecida (53) -STR_0086 :Atracción Descoñecida (54) -STR_0087 :Atracción Descoñecida (55) STR_0088 :Montaña rusa de impulso inverso STR_0089 :Mini montaña rusa STR_0090 :Atracción da mina -STR_0091 :Atracción Descoñecida (59) STR_0092 :Montaña Rusa Lanzada por MIL STR_0093 :Montaña Rusa Híbrida STR_0094 :Montaña rusa dun só raíl @@ -3842,3 +3833,4 @@ STR_7003 :O ficheiro de son ‘{STRING}’ está incompleto. Agardabase {INT3 STR_7004 :Forzar redeseño STR_7005 :Arrastra unha área de camiño STR_7006 :Debuxa un bordo arredor dos botóns de imaxe +STR_7007 :Tipo de atracción diff --git a/data/language/hu-HU.txt b/data/language/hu-HU.txt index 7cac004fb2..b6dfdef848 100644 --- a/data/language/hu-HU.txt +++ b/data/language/hu-HU.txt @@ -32,12 +32,9 @@ STR_0027 :Dodzsem STR_0028 :Hajóhinta STR_0029 :Fejreálló hajóhinta STR_0030 :Ételes bódé -STR_0031 :Ismeretlen bódé (1D) STR_0032 :Italos bódé -STR_0033 :Ismeretlen bódé (1F) STR_0034 :Bolt STR_0035 :Körhinta -STR_0036 :Ismeretlen bódé (22) STR_0037 :Információs bódé STR_0038 :WC STR_0039 :Óriáskerék @@ -83,16 +80,10 @@ STR_0078 :Fordított hajtű hullámvasút STR_0079 :Varázsszőnyeg STR_0080 :Tengeralattjáró-játék STR_0081 :Folyami tutajok -STR_0082 :Ismeretlen játék (50) STR_0083 :Enterprise -STR_0084 :Ismeretlen játék (52) -STR_0085 :Ismeretlen játék (53) -STR_0086 :Ismeretlen játék (54) -STR_0087 :Ismeretlen játék (55) STR_0088 :Fordított impulzus hullámvasút STR_0089 :Mini hullámvasút STR_0090 :Bányavasút -STR_0091 :Ismeretlen játék (59) STR_0092 :Aszinkronmotoros hullámvasút STR_0093 :Hibrid hullámvasút STR_0094 :Egysínű hullámvasút @@ -3842,3 +3833,5 @@ STR_7003 :A(z) „{STRING}” hangfájl csonka. Minta {INT32} lenne az elvár STR_7004 :Újrarajzolás kényszerítése STR_7005 :Útterület építése húzással STR_7006 :Keret rajzolása a képgombok köré +STR_7007 :Játéktípus +STR_7008 :Ismeretlen játéktípus ({INT32}) diff --git a/data/language/it-IT.txt b/data/language/it-IT.txt index 3f90ee919d..d8a9985cea 100644 --- a/data/language/it-IT.txt +++ b/data/language/it-IT.txt @@ -32,12 +32,9 @@ STR_0027 :Autoscontri STR_0028 :Nave dei pirati STR_0029 :Nave oscillante invertita STR_0030 :Chiosco del cibo -STR_0031 :Chiosco sconosciuto (1D) STR_0032 :Chiosco delle bibite -STR_0033 :Chiosco sconosciuto (1F) STR_0034 :Chiosco STR_0035 :Giostra -STR_0036 :Chiosco sconosciuto (22) STR_0037 :Chiosco STR_0038 :Servizi igienici STR_0039 :Ruota panoramica @@ -83,16 +80,10 @@ STR_0078 :Ottovolante sottile invertito STR_0079 :Tappeto magico STR_0080 :Corsa sottomarina STR_0081 :River Rafts -STR_0082 :Attrazione sconosciuta (50) STR_0083 :Enterprise -STR_0084 :Attrazione sconosciuta (52) -STR_0085 :Attrazione sconosciuta (53) -STR_0086 :Attrazione sconosciuta (54) -STR_0087 :Attrazione sconosciuta (55) STR_0088 :Ottovolante invertito a impulso STR_0089 :Mini-ottovolante STR_0090 :Corsa nella miniera -STR_0091 :Attrazione sconosciuta (59) STR_0092 :Ottovolante a lancio MIL STR_0093 :Ottovolante ibrido STR_0094 :Ottovolante a binario singolo diff --git a/data/language/ja-JP.txt b/data/language/ja-JP.txt index f3c7cfd3c4..7b8282665e 100644 --- a/data/language/ja-JP.txt +++ b/data/language/ja-JP.txt @@ -32,12 +32,9 @@ STR_0027 :バンパーカー STR_0028 :パイレーツシップ STR_0029 :スイング・インバータ・シップ STR_0030 :食べ物の店 -STR_0031 :Unknown Stall (1D) STR_0032 :飲料の店 -STR_0033 :Unknown Stall (1F) STR_0034 :ショップ STR_0035 :メリーゴーラウンド -STR_0036 :Unknown Stall (22) STR_0037 :インフォーメーションセンター STR_0038 :トイレ STR_0039 :観覧車 @@ -83,16 +80,10 @@ STR_0078 :インバーテッドヘアピンコースター STR_0079 :空飛ぶじゅうたん STR_0080 :潜水艦ライド STR_0081 :川いかだ -STR_0082 :Unknown Ride (50) STR_0083 :エンタープライズ -STR_0084 :Unknown Ride (52) -STR_0085 :Unknown Ride (53) -STR_0086 :Unknown Ride (54) -STR_0087 :Unknown Ride (55) STR_0088 :インバーテッドインパルスコースター STR_0089 :ミニジェットコースター STR_0090 :鉱山ライド -STR_0091 :Unknown Ride (59) STR_0092 :リニアモーターコースター STR_0093 :ハイブリッドコースター STR_0094 :シングルレール・ジェットコースター diff --git a/data/language/ko-KR.txt b/data/language/ko-KR.txt index e1de5bb2b8..b935769a7c 100644 --- a/data/language/ko-KR.txt +++ b/data/language/ko-KR.txt @@ -32,12 +32,9 @@ STR_0027 :범퍼카 STR_0028 :바이킹 STR_0029 :360도 바이킹 STR_0030 :음식 상점 -STR_0031 :알 수 없는 상점 (1D) STR_0032 :음료수 상점 -STR_0033 :알 수 없는 상점 (1F) STR_0034 :상점 STR_0035 :회전목마 -STR_0036 :알 수 없는 상점 (22) STR_0037 :안내소 STR_0038 :화장실 STR_0039 :관람차 @@ -83,16 +80,10 @@ STR_0078 :인버티드 헤어핀 코스터 STR_0079 :마법의 양탄자 STR_0080 :서브마린 라이드 STR_0081 :리버 래프트 -STR_0082 :알 수 없는 놀이기구 (50) STR_0083 :엔터프라이즈 -STR_0084 :알 수 없는 놀이기구 (52) -STR_0085 :알 수 없는 놀이기구 (53) -STR_0086 :알 수 없는 놀이기구 (54) -STR_0087 :알 수 없는 놀이기구 (55) STR_0088 :인버티드 임펄스 코스터 STR_0089 :미니 롤러코스터 STR_0090 :마인 라이드 -STR_0091 :알 수 없는 놀이기구 (59) STR_0092 :LIM 발진 롤러코스터 STR_0093 :하이브리드 코스터 STR_0094 :모노레일 롤러코스터 @@ -3845,3 +3836,5 @@ STR_7003 :오디오 파일(‘{STRING}’) 데이터가 잘려있습니다. { STR_7004 :강제 화면 갱신 STR_7005 :드래그로 보도 건설 STR_7006 :버튼 주위에 경계선 표시 +STR_7007 :놀이기구 종류 +STR_7008 :알 수 없는 놀이기구 종류 ({INT32}) diff --git a/data/language/nb-NO.txt b/data/language/nb-NO.txt index 670d500567..18af191963 100644 --- a/data/language/nb-NO.txt +++ b/data/language/nb-NO.txt @@ -32,12 +32,9 @@ STR_0027 :Radiobiler STR_0028 :Piratskip STR_0029 :Roterende skip STR_0030 :Matbod -STR_0031 :Ukjent bod (1D) STR_0032 :Drikkebod -STR_0033 :Ukjent bod (1F) STR_0034 :Bod STR_0035 :Karusell -STR_0036 :Ukjent bod (22) STR_0037 :Informasjonskiosk STR_0038 :Toaletter STR_0039 :Pariserhjul @@ -83,16 +80,10 @@ STR_0078 :Invertert hårnålsbane STR_0079 :Flyvende teppe STR_0080 :Ubåtbane STR_0081 :Elveflåter -STR_0082 :Ukjent attraksjon (50) STR_0083 :Enterprise -STR_0084 :Ukjent attraksjon (52) -STR_0085 :Ukjent attraksjon (53) -STR_0086 :Ukjent attraksjon (54) -STR_0087 :Ukjent attraksjon (55) STR_0088 :Invertert impulsbane STR_0089 :Miniberg-og-dal-bane STR_0090 :Gruvebane -STR_0091 :Ukjent attraksjon (59) STR_0092 :LIM-berg-og-dal-bane STR_0093 :Hybrid berg-og-dal-bane STR_0094 :Enkeltspor berg-og-dal-bane diff --git a/data/language/nl-NL.txt b/data/language/nl-NL.txt index c68013fec4..9643050f41 100644 --- a/data/language/nl-NL.txt +++ b/data/language/nl-NL.txt @@ -29,12 +29,9 @@ STR_0027 :Botsauto’s STR_0028 :Schommelschip STR_0029 :Loopingschip STR_0030 :Eetkraam -STR_0031 :Onbekende kraam (1D) STR_0032 :Drankkraam -STR_0033 :Onbekende kraam (1F) STR_0034 :Winkel STR_0035 :Draaimolen -STR_0036 :Onbekende kraam (22) STR_0037 :Informatiekiosk STR_0038 :Toilet STR_0039 :Reuzenrad @@ -80,16 +77,10 @@ STR_0078 :Omgekeerde haarspeldachtbaan STR_0079 :Vliegend tapijt STR_0080 :Onderzeeër-attractie STR_0081 :Riviertocht -STR_0082 :Onbekende attractie (50) STR_0083 :Enterprise -STR_0084 :Onbekende attractie (52) -STR_0085 :Onbekende attractie (53) -STR_0086 :Onbekende attractie (54) -STR_0087 :Onbekende attractie (55) STR_0088 :Omgekeerde Impulse-achtbaan STR_0089 :Mini-achtbaan STR_0090 :Aangedreven mijntrein -STR_0091 :Onbekende attractie (59) STR_0092 :LIM-lanceringsachtbaan STR_0093 :Hybride achtbaan STR_0094 :Achtbaan met enkele rail @@ -3840,3 +3831,6 @@ STR_7002 :{STRINGID} {STRINGID} STR_7003 :Audiobestand ‘{STRING}’ is beschadigd. Sample nr. {INT32} kon niet worden geladen, aangezien er maar {INT32} beschikbaar zijn. Installeer RollerCoaster Tycoon 2 opnieuw. STR_7004 :Volledig beeld hertekenen STR_7005 :Voetpaden aanleggen door te slepen +STR_7006 :Rand tekenen om knoppen met alleen een plaatje +STR_7007 :Attractietype +STR_7008 :Onbekend attractietype ({INT32}) diff --git a/data/language/pl-PL.txt b/data/language/pl-PL.txt index 03c72fa953..2c185a76eb 100644 --- a/data/language/pl-PL.txt +++ b/data/language/pl-PL.txt @@ -32,12 +32,9 @@ STR_0027 :Unikajki STR_0028 :Okręt piracki STR_0029 :Morska huśtawka STR_0030 :Budka z jedzeniem -STR_0031 :Nieznane stoisko (1D) STR_0032 :Budka z napojami -STR_0033 :Nieznane stoisko (1F) STR_0034 :Stoisko STR_0035 :Karuzela obrotowa -STR_0036 :Nieznane stoisko (22) STR_0037 :Punkt informacyjny STR_0038 :Toalety STR_0039 :Diabelski młyn @@ -83,16 +80,10 @@ STR_0078 :Kolejka serpentynowa STR_0079 :Latający dywan STR_0080 :Podwodna podróż STR_0081 :Tratwy rzeczne -STR_0082 :Nieznana atrakcja (50) STR_0083 :Krynolina -STR_0084 :Nieznana atrakcja (52) -STR_0085 :Nieznana atrakcja (53) -STR_0086 :Nieznana atrakcja (54) -STR_0087 :Nieznana atrakcja (55) STR_0088 :Kolejka zwrotna STR_0089 :Minikolejka STR_0090 :Przejażdżka kopalniana -STR_0091 :Nieznana atrakcja (59) STR_0092 :Kolejka z napędem indukcyjnym liniowym STR_0093 :Kolejka hybrydowa STR_0094 :Kolejka jednoszynowa diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index 55b53037eb..14778594e4 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -32,12 +32,9 @@ STR_0027 :Carrinho de Bate-Bate STR_0028 :Barco Viking STR_0029 :Navio de Balanço Reverso STR_0030 :Barraca de Comida -STR_0031 :Barraca Desconhecida (1D) STR_0032 :Barraca de Bebida -STR_0033 :Barraca Desconhecida (1F) STR_0034 :Loja STR_0035 :Carrossel -STR_0036 :Barraca Desconhecida (22) STR_0037 :Quiosque de Informações STR_0038 :Banheiros STR_0039 :Roda Gigante @@ -83,16 +80,10 @@ STR_0078 :Montanha Fechada Invertida STR_0079 :Tapete Mágico STR_0080 :Submarino STR_0081 :Balsas de rio -STR_0082 :Brinquedo Desconhecido (50) STR_0083 :Enterprise -STR_0084 :Brinquedo Desconhecido (52) -STR_0085 :Brinquedo Desconhecido (53) -STR_0086 :Brinquedo Desconhecido (54) -STR_0087 :Brinquedo Desconhecido (55) STR_0088 :Montanha de Impulso Invertida STR_0089 :Minimontanha-Russa STR_0090 :Brinquedo de Mina -STR_0091 :Brinquedo Desconhecido (59) STR_0092 :Montanha-Russa de Indução Linear STR_0093 :Montanha-Russa Híbrida STR_0094 :Montanha-Russa de Trilho Único @@ -3841,3 +3832,6 @@ STR_7002 :{STRINGID} {STRINGID} STR_7003 :O arquivo de áudio ‘{STRING}’ está incompleto. {INT32} amostras eram esperadas, mas apenas {INT32} estão disponíveis. Considere reinstalar o RCT2. STR_7004 :Forçar Redesenho STR_7005 :Arrastar uma área de calçada +STR_7006 :Desenhar borda ao redor dos botões com imagens +STR_7007 :Tipo de Atração +STR_7008 :Tipo de atração desconhecido ({INT32}) diff --git a/data/language/ru-RU.txt b/data/language/ru-RU.txt index c76ca1961b..b5ecffae10 100644 --- a/data/language/ru-RU.txt +++ b/data/language/ru-RU.txt @@ -32,12 +32,9 @@ STR_0027 :Автодром STR_0028 :Пиратский корабль STR_0029 :Раскачивающийся инвертированный корабль STR_0030 :Киоск с едой -STR_0031 :Неизвестный киоск (1D) STR_0032 :Киоск с питьём -STR_0033 :Неизвестный киоск (1F) STR_0034 :Магазинчик STR_0035 :Карусель -STR_0036 :Неизвестный киоск (22) STR_0037 :Информационный стенд STR_0038 :Туалеты STR_0039 :Колесо обозрения @@ -83,16 +80,10 @@ STR_0078 :Горки «Обратная шпилька» STR_0079 :Ковёр-самолёт STR_0080 :Заплыв на подводной лодке STR_0081 :Речной рафтинг -STR_0082 :Неизвестный аттракцион (50) STR_0083 :Центрифуга -STR_0084 :Неизвестный аттракцион (52) -STR_0085 :Неизвестный аттракцион (53) -STR_0086 :Неизвестный аттракцион (54) -STR_0087 :Неизвестный аттракцион (55) STR_0088 :Инвертированные импульсные горки STR_0089 :Мини-горки STR_0090 :Шахтёрская поездка -STR_0091 :Неизвестный аттракцион (59) STR_0092 :Горки с запуском ЛИМ STR_0093 :Гибридные горки STR_0094 :Горки с одним рельсом @@ -3829,3 +3820,5 @@ STR_7002 :{STRINGID} {STRINGID} STR_7003 :Аудио-файл «{STRING}» повреждён. Ожидалось {INT32} образцов, но доступны только {INT32}. Рекомендуется повторная установка RCT2. STR_7004 :Полная перерисовка STR_7006 :Бордюр на кнопках с изображениями +STR_7007 :Тип аттр. +STR_7008 :Неизвестный аттракцион ({INT32}) diff --git a/data/language/sv-SE.txt b/data/language/sv-SE.txt index f7fbdb412b..379f54c25f 100644 --- a/data/language/sv-SE.txt +++ b/data/language/sv-SE.txt @@ -33,12 +33,9 @@ STR_0027 :Radiobilar STR_0028 :Piratskepp STR_0029 :Svängande omvänt piratskepp STR_0030 :Matstånd -STR_0031 :Okänt stånd (1D) STR_0032 :Dryckesstånd -STR_0033 :Okänt stånd (1F) STR_0034 :Stånd STR_0035 :Karusell -STR_0036 :Okänt stånd (22) STR_0037 :Informationskiosk STR_0038 :Toaletter STR_0039 :Pariserhjul @@ -84,16 +81,10 @@ STR_0078 :Inverterad hårnålsbana STR_0079 :Flygande matta STR_0080 :Ubåtsbana STR_0081 :Flodflottar -STR_0082 :Okänd åktur (50) STR_0083 :Enterprise -STR_0084 :Okänd åktur (52) -STR_0085 :Okänd åktur (53) -STR_0086 :Okänd åktur (54) -STR_0087 :Okänd åktur (55) STR_0088 :Inverterad impulsbana STR_0089 :Miniberg- och dalbana STR_0090 :Gruvattraktion -STR_0091 :Okänd åktur (59) STR_0092 :Induktionsberg- och dalbana STR_0093 :Hybridberg- och dalbana STR_0094 :Enkelspårig berg- och dalbana diff --git a/data/language/tr-TR.txt b/data/language/tr-TR.txt index ef5290f0b1..416b866988 100644 --- a/data/language/tr-TR.txt +++ b/data/language/tr-TR.txt @@ -32,12 +32,9 @@ STR_0027 :Çarpışan Arabalar STR_0028 :Korsan Gemisi STR_0029 :Tepe Takla Gemisi STR_0030 :Yiyecek Standı -STR_0031 :Bilinmeyen Stant (1D) STR_0032 :İçecek Standı -STR_0033 :Bilinmeyen Stant (1F) STR_0034 :Dükkan STR_0035 :Atlıkarınca -STR_0036 :Bilinmeyen Stant (22) STR_0037 :Danışma STR_0038 :Tuvalet STR_0039 :Dönme Dolap @@ -83,16 +80,10 @@ STR_0078 :Teleferik Treni STR_0079 :Sihirli Halı STR_0080 :Denizaltı Kiralama STR_0081 :Sal Seyahati -STR_0082 :Bilinmeyen Alet (50) STR_0083 :Dönen Teker -STR_0084 :Bilinmeyen Alet (52) -STR_0085 :Bilinmeyen Alet (53) -STR_0086 :Bilinmeyen Alet (54) -STR_0087 :Bilinmeyen Alet (55) STR_0088 :Vida Treni STR_0089 :Mini Tren STR_0090 :Küçük Maden Treni -STR_0091 :Bilinmeyen Alet (59) STR_0092 :LIM Tren STR_0096 :Klasik Tahta Tren STR_0512 :Sarmal şeklinde tırmanma zinciri rayı ile yükseğe çıkabilen çelik yapılı bir tren diff --git a/data/language/uk-UA.txt b/data/language/uk-UA.txt index cd5986b4ba..945a0b3674 100644 --- a/data/language/uk-UA.txt +++ b/data/language/uk-UA.txt @@ -32,12 +32,9 @@ STR_0027 :Виверти STR_0028 :Корабель-гойдалка STR_0029 :Гойдалка з інвертором STR_0030 :Магазинчик їжі -STR_0031 :Невідомий кіоск (1Д) STR_0032 :Магазинчик напоїв -STR_0033 :Невідомий кіоск (1Ф) STR_0034 :Магазин STR_0035 :Весела карусель -STR_0036 :Невідомий кіоск (22) STR_0037 :Довідковий кіоск STR_0038 :Туалети STR_0039 :Оглядове колесо @@ -83,16 +80,10 @@ STR_0078 :Перевернута підставка для шпильок STR_0079 :Чарівний килим STR_0080 :Підводний човен STR_0081 :Річкові плоти -STR_0082 :Невідомий атракціон (50) STR_0083 :Підприємство -STR_0084 :Невідомий атракціон (52) -STR_0085 :Невідомий атракціон (53) -STR_0086 :Невідомий атракціон (54) -STR_0087 :Невідомий атракціон (55) STR_0088 :Перевернуті імпульсні атракціони STR_0089 :Міні американські гірки STR_0090 :Атракціон "Шахта" -STR_0091 :Невідомий атракціон (59) STR_0092 :Американські гірки, що запускаються LIM STR_0093 :Гібридні американські гірки STR_0094 :Однорейкові американські гірки diff --git a/data/language/vi-VN.txt b/data/language/vi-VN.txt index 2a01d4b0ca..8a81a347de 100644 --- a/data/language/vi-VN.txt +++ b/data/language/vi-VN.txt @@ -32,12 +32,9 @@ STR_0027 :Xe điện đụng STR_0028 :Tàu cướp biển STR_0029 :Tàu lượn siêu tốc xoay tròn STR_0030 :Quầy đồ ăn -STR_0031 :Quầy không xác định (1D) STR_0032 :Quầy đồ uống -STR_0033 :Quầy không xác định (1F) STR_0034 :Cửa hàng STR_0035 :Đu quay ngựa gỗ -STR_0036 :Quầy không xác định (22) STR_0037 :Quầy thông tin STR_0038 :Nhà vệ sinh STR_0039 :Vòng quay Ferris @@ -83,16 +80,10 @@ STR_0078 :Tàu lượn ngược hình kẹp tóc STR_0079 :Thảm thần STR_0080 :Tàu ngầm STR_0081 :Thuyền bè -STR_0082 :Trò chơi không xác định (50) STR_0083 :Vòng quay Enterprise -STR_0084 :Trò chơi không xác định (52) -STR_0085 :Trò chơi không xác định (53) -STR_0086 :Trò chơi không xác định (54) -STR_0087 :Trò chơi không xác định (55) STR_0088 :Tàu lượn siêu tốc xung ngược STR_0089 :Tàu lượn siêu tốc mini STR_0090 :Chuyến tàu mỏ -STR_0091 :Trò chơi không xác định (59) STR_0092 :Tàu lượn siêu tốc khởi động LIM STR_0093 :Tàu lượn siêu tốc lai STR_0094 :Tàu lượn siêu tốc một ray diff --git a/data/language/zh-CN.txt b/data/language/zh-CN.txt index 70f3763a67..702b1241bb 100644 --- a/data/language/zh-CN.txt +++ b/data/language/zh-CN.txt @@ -32,12 +32,9 @@ STR_0027 :碰碰车 STR_0028 :海盗船 STR_0029 :摇摆海盗船 STR_0030 :食品小站 -STR_0031 :未知店铺(1D) STR_0032 :饮料铺 -STR_0033 :未知店铺(1F) STR_0034 :商店 STR_0035 :旋转木马 -STR_0036 :未知店铺(22) STR_0037 :信息亭 STR_0038 :厕所 STR_0039 :摩天轮 @@ -83,16 +80,10 @@ STR_0078 :回转发卡过山车 STR_0079 :魔毯 STR_0080 :迷你潜艇 STR_0081 :水上木筏 -STR_0082 :未知游乐设施(50) STR_0083 :企业号 -STR_0084 :未知游乐设施(52) -STR_0085 :未知游乐设施(53) -STR_0086 :未知游乐设施(54) -STR_0087 :未知游乐设施(55) STR_0088 :回转冲力过山车 STR_0089 :迷你过山车 STR_0090 :矿车式过山车 -STR_0091 :未知游乐设施(59) STR_0092 :LIM喷射过山车 STR_0093 :混合过山车 STR_0094 :单轨过山车 diff --git a/data/language/zh-TW.txt b/data/language/zh-TW.txt index eb279738bc..176b3e52d1 100644 --- a/data/language/zh-TW.txt +++ b/data/language/zh-TW.txt @@ -32,12 +32,9 @@ STR_0027 :碰碰車 STR_0028 :海盜船 STR_0029 :垂直迴轉海盜船 STR_0030 :食物店鋪 -STR_0031 :Unknown Stall (1D) STR_0032 :飲料店鋪 -STR_0033 :Unknown Stall (1F) STR_0034 :商店 STR_0035 :旋轉木馬 -STR_0036 :Unknown Stall (22) STR_0037 :訪客資訊中心 STR_0038 :廁所 STR_0039 :摩天輪 @@ -83,16 +80,10 @@ STR_0078 :反轉髮夾彎式雲霄飛車 STR_0079 :魔法地毯 STR_0080 :潛艇遊道 STR_0081 :木筏河道 -STR_0082 :Unknown Ride (50) STR_0083 :太空摩天輪 -STR_0084 :Unknown Ride (52) -STR_0085 :Unknown Ride (53) -STR_0086 :Unknown Ride (54) -STR_0087 :Unknown Ride (55) STR_0088 :反轉極速式雲霄飛車 STR_0089 :迷你雲霄飛車 STR_0090 :礦遊式雲霄飛車 -STR_0091 :Unknown Ride (59) STR_0092 :直線電動機發車雲霄飛車 STR_0093 :混合式雲霄飛車 STR_0094 :單軌式雲霄飛車 diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 8759f51c3c..ee9881f99c 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,3 +1,28 @@ +0.4.29 (in development) +------------------------------------------------------------------------ +- Feature: [#25459] Wall line dragging tool. +- Improved: [#25028] Stalls now support colour presets, just like regular rides. +- Improved: [#25426] Building the track designs index is now quicker. +- Improved: [#25490] The ‘New Ride’ window can now be resized. +- Fix: [#6228] The saved queue line path connections are not preserved when placing track designs (original bug). +- Fix: [#14365] Track designs with scenery below the lowest track piece do not preview correctly. +- Fix: [#25451] Dropdown item tooltips stay open if the mouse is moved over an empty space. +- Fix: [#25454] Opening the land tool while building a path bridge or tunnel closes the Footpaths window. +- Fix: [#25461] Path connections in raised track designs are sometimes broken when placed. +- Fix: [#25467] Paths are not connected together correctly in track design previews. +- Fix: [#25476] When both RCT2 and RCT1 are present, autodetection fails. +- Fix: [#25480] The mini track design preview and price are misaligned in Enlarged UI mode. +- Fix: [#25488] Crash in headless mode. +- Fix: [#25494] The Go-Karts steep to flat track does not draw correctly in the flat side tunnel. +- Fix: [#25518] The virtual floor does not draw correctly if expanded on the positive x and y axes. +- Fix: [#25519] Crackling audio when sampling frequencies do not match. +- Fix: [objects#401] Round tunnels on down slopes glitch. +- Fix: [objects#404] Wooden Wild Mine cars incorrectly allow setting a third remap colour. +- Fix: [objects#408] Australian fountain sets have confusing naming. +- Fix: [objects#409] LIM Launched Coaster trains incorrectly have a 10% intensity modifier set (original bug). +- Fix: [objects#410] Large scenery from the Wacky Worlds Africa theming have incorrect previews when using specific versions of the RCT2 base game. +- Fix: [objects#415] Penguin bobsleigh trains show incorrect sprites on the 12° down slope (original bug). + 0.4.28 (2025-11-01) ------------------------------------------------------------------------ - Feature: [#25286] Footpath area dragging tool. diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index 5dc8062478..69dc880176 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -5354,11 +5354,11 @@ declare global { write(data: string): boolean; on(event: "close", callback: (hadError: boolean) => void): Socket; - on(event: "error", callback: (hadError: boolean) => void): Socket; + on(event: "error", callback: (errorString: string) => void): Socket; on(event: "data", callback: (data: string) => void): Socket; off(event: "close", callback: (hadError: boolean) => void): Socket; - off(event: "error", callback: (hadError: boolean) => void): Socket; + off(event: "error", callback: (errorString: string) => void): Socket; off(event: "data", callback: (data: string) => void): Socket; } diff --git a/openrct2.deps.targets b/openrct2.deps.targets index 2d43e50394..34aea9797e 100644 --- a/openrct2.deps.targets +++ b/openrct2.deps.targets @@ -218,8 +218,8 @@ 490263b873dd02c13a043a04d26bb9837d2d378dacd8b2c8d29660fef44db3db https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.26/title-sequences.zip dabb9787b1576342fca4dd9f64b3f8cfa04a7e6ce9c2bb9610f47b762905c858 - https://github.com/OpenRCT2/objects/releases/download/v1.7.3/objects.zip - c81029264578706ed1db88665e12a70a583e71dc4d3eb4db262535d2f0589eab + https://github.com/OpenRCT2/objects/releases/download/v1.7.5/objects.zip + c8b9d3039a920f67caf15b09e8312cc4f80d59ed7fe0288625b9ccedef606797 https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.6/opensound.zip 06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index 39d72a38f9..9d3d72d8cd 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -1574,15 +1574,7 @@ namespace OpenRCT2 STR_RIDE_MODE_NUMBER_OF_SWINGS_VALUE = 1771, STR_RIDE_MODE_SPEED_VALUE = 1331, STR_RIDE_MODE_TIME_LIMIT_VALUE = 1749, - STR_RIDE_NAME_1D = 31, - STR_RIDE_NAME_1F = 33, - STR_RIDE_NAME_22 = 36, - STR_RIDE_NAME_50 = 82, - STR_RIDE_NAME_52 = 84, - STR_RIDE_NAME_53 = 85, - STR_RIDE_NAME_54 = 86, - STR_RIDE_NAME_55 = 87, - STR_RIDE_NAME_59 = 91, + STR_RIDE_NAME_UNKNOWN_INT32 = 7008, STR_RIDE_SECONDARY_PRICE_VALUE = 1799, STR_RIDE_STATS_ALTITUDE = 1416, STR_RIDE_STATS_ALTITUDE_FORMAT = 1420, diff --git a/src/openrct2-ui/audio/AudioChannel.cpp b/src/openrct2-ui/audio/AudioChannel.cpp index c033a0e700..f188e7637d 100644 --- a/src/openrct2-ui/audio/AudioChannel.cpp +++ b/src/openrct2-ui/audio/AudioChannel.cpp @@ -254,7 +254,7 @@ namespace OpenRCT2::Audio size_t readLen = _source->Read(dst, _offset, bytesToRead); if (readLen > 0) { - dst = reinterpret_cast(reinterpret_cast(dst) + readLen); + dst = static_cast(static_cast(dst) + readLen); bytesToRead -= readLen; bytesRead += readLen; _offset += readLen; diff --git a/src/openrct2-ui/audio/AudioMixer.cpp b/src/openrct2-ui/audio/AudioMixer.cpp index 01a7de4bde..a52acc7f73 100644 --- a/src/openrct2-ui/audio/AudioMixer.cpp +++ b/src/openrct2-ui/audio/AudioMixer.cpp @@ -40,9 +40,9 @@ void AudioMixer::Init(const char* device) SDL_AudioSpec have; _deviceId = SDL_OpenAudioDevice(device, 0, &want, &have, 0); - _format.format = have.format; - _format.channels = have.channels; - _format.freq = have.freq; + _outputFormat.format = have.format; + _outputFormat.channels = have.channels; + _outputFormat.freq = have.freq; SDL_PauseAudioDevice(_deviceId, 0); } @@ -121,7 +121,7 @@ void AudioMixer::RemoveReleasedSources() const AudioFormat& AudioMixer::GetFormat() const { - return _format; + return _outputFormat; } void AudioMixer::GetNextAudioChunk(uint8_t* dst, size_t length) @@ -173,10 +173,10 @@ void AudioMixer::UpdateAdjustedSound() void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t length) { - int32_t byteRate = _format.GetByteRate(); - auto numSamples = static_cast(length / byteRate); + int32_t outputByteRate = _outputFormat.GetByteRate(); + auto numSamples = static_cast(length / outputByteRate); double rate = 1; - if (_format.format == AUDIO_S16SYS) + if (_outputFormat.format == AUDIO_S16SYS) { rate = channel->GetRate(); } @@ -185,11 +185,11 @@ void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t len SDL_AudioCVT cvt; cvt.len_ratio = 1; AudioFormat streamformat = channel->GetFormat(); - if (streamformat != _format) + if (streamformat != _outputFormat) { if (SDL_BuildAudioCVT( - &cvt, streamformat.format, streamformat.channels, streamformat.freq, _format.format, _format.channels, - _format.freq) + &cvt, streamformat.format, streamformat.channels, streamformat.freq, _outputFormat.format, + _outputFormat.channels, _outputFormat.freq) == -1) { // Unable to convert channel data @@ -200,7 +200,7 @@ void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t len // Read raw PCM from channel int32_t readSamples = numSamples * rate; - auto readLength = static_cast(readSamples / cvt.len_ratio) * byteRate; + auto readLength = static_cast(ceil(readSamples / cvt.len_ratio)) * outputByteRate; _channelBuffer.resize(readLength); size_t bytesRead = channel->Read(_channelBuffer.data(), readLength); @@ -228,43 +228,45 @@ void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t len // Apply effects if (rate != 1) { - auto inRate = static_cast(bufferLen / byteRate); + auto inRate = static_cast(bufferLen / outputByteRate); int32_t outRate = numSamples; if (bytesRead != readLength) { - inRate = _format.freq; - outRate = _format.freq * (1 / rate); + inRate = _outputFormat.freq; + outRate = _outputFormat.freq * (1 / rate); } _effectBuffer.resize(length); - bufferLen = ApplyResample(channel, buffer, static_cast(bufferLen / byteRate), numSamples, inRate, outRate); + bufferLen = ApplyResample( + channel, buffer, static_cast(bufferLen / outputByteRate), numSamples, inRate, outRate); buffer = _effectBuffer.data(); } // Apply panning and volume - ApplyPan(channel, buffer, bufferLen, byteRate); + ApplyPan(channel, buffer, bufferLen, outputByteRate); int32_t mixVolume = ApplyVolume(channel, buffer, bufferLen); // Finally mix on to destination buffer size_t dstLength = std::min(length, bufferLen); - SDL_MixAudioFormat(data, static_cast(buffer), _format.format, static_cast(dstLength), mixVolume); + SDL_MixAudioFormat( + data, static_cast(buffer), _outputFormat.format, static_cast(dstLength), mixVolume); channel->UpdateOldVolume(); } /** * Resample the given buffer into _effectBuffer. - * Assumes that srcBuffer is the same format as _format. + * Assumes that srcBuffer is the same format as _outputFormat. */ size_t AudioMixer::ApplyResample( ISDLAudioChannel* channel, const void* srcBuffer, int32_t srcSamples, int32_t dstSamples, int32_t inRate, int32_t outRate) { - int32_t byteRate = _format.GetByteRate(); + int32_t outputByteRate = _outputFormat.GetByteRate(); // Create resampler SpeexResamplerState* resampler = channel->GetResampler(); if (resampler == nullptr) { - resampler = speex_resampler_init(_format.channels, _format.freq, _format.freq, 0, nullptr); + resampler = speex_resampler_init(_outputFormat.channels, _outputFormat.freq, _outputFormat.freq, 0, nullptr); channel->SetResampler(resampler); } speex_resampler_set_rate(resampler, inRate, outRate); @@ -275,14 +277,14 @@ size_t AudioMixer::ApplyResample( resampler, static_cast(srcBuffer), &inLen, reinterpret_cast(_effectBuffer.data()), &outLen); - return outLen * byteRate; + return outLen * outputByteRate; } void AudioMixer::ApplyPan(const IAudioChannel* channel, void* buffer, size_t len, size_t sampleSize) { - if (channel->GetPan() != 0.5f && _format.channels == 2) + if (channel->GetPan() != 0.5f && _outputFormat.channels == 2) { - switch (_format.format) + switch (_outputFormat.format) { case AUDIO_S16SYS: EffectPanS16(channel, static_cast(buffer), static_cast(len / sampleSize)); @@ -331,8 +333,8 @@ int32_t AudioMixer::ApplyVolume(const IAudioChannel* channel, void* buffer, size mixVolume = kMixerVolumeMax; // Fade between volume levels to smooth out sound and minimize clicks from sudden volume changes - int32_t fadeLength = static_cast(len) / _format.BytesPerSample(); - switch (_format.format) + int32_t fadeLength = static_cast(len) / _outputFormat.BytesPerSample(); + switch (_outputFormat.format) { case AUDIO_S16SYS: EffectFadeS16(static_cast(buffer), fadeLength, startVolume, endVolume); diff --git a/src/openrct2-ui/audio/AudioMixer.h b/src/openrct2-ui/audio/AudioMixer.h index 549cb89b91..7e4aaa782c 100644 --- a/src/openrct2-ui/audio/AudioMixer.h +++ b/src/openrct2-ui/audio/AudioMixer.h @@ -33,7 +33,7 @@ namespace OpenRCT2::Audio std::vector> _sources; SDL_AudioDeviceID _deviceId = 0; - AudioFormat _format = {}; + AudioFormat _outputFormat = {}; std::list> _channels; float _volume = 1.0f; float _adjustSoundVolume = 0.0f; @@ -67,7 +67,7 @@ namespace OpenRCT2::Audio /** * Resample the given buffer into _effectBuffer. - * Assumes that srcBuffer is the same format as _format. + * Assumes that srcBuffer is the same format as _outputFormat. */ size_t ApplyResample( ISDLAudioChannel* channel, const void* srcBuffer, int32_t srcSamples, int32_t dstSamples, int32_t inRate, diff --git a/src/openrct2-ui/audio/FlacAudioSource.cpp b/src/openrct2-ui/audio/FlacAudioSource.cpp index 17a5665659..accdcb299d 100644 --- a/src/openrct2-ui/audio/FlacAudioSource.cpp +++ b/src/openrct2-ui/audio/FlacAudioSource.cpp @@ -96,7 +96,7 @@ namespace OpenRCT2::Audio _currentOffset = offset; } - auto dst8 = reinterpret_cast(dst); + auto dst8 = static_cast(dst); auto bytesRead = ReadFromDecodeBuffer(dst8, len); dst8 += bytesRead; if (bytesRead < len) @@ -171,7 +171,7 @@ namespace OpenRCT2::Audio static FLAC__StreamDecoderReadStatus FlacCallbackRead( const FLAC__StreamDecoder* decoder, FLAC__byte buffer[], size_t* bytes, void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); if (*bytes > 0) { *bytes = SDL_RWread(self->_rw, buffer, sizeof(FLAC__byte), *bytes); @@ -193,7 +193,7 @@ namespace OpenRCT2::Audio static FLAC__StreamDecoderSeekStatus FlacCallbackSeek( const FLAC__StreamDecoder* decoder, FLAC__uint64 absoluteByteOffset, void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); if (SDL_RWseek(self->_rw, absoluteByteOffset, RW_SEEK_SET) < 0) { return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; @@ -207,7 +207,7 @@ namespace OpenRCT2::Audio static FLAC__StreamDecoderTellStatus FlacCallbackTell( const FLAC__StreamDecoder* decoder, FLAC__uint64* absoluteByteOffset, void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); auto pos = SDL_RWtell(self->_rw); if (pos < 0) { @@ -223,7 +223,7 @@ namespace OpenRCT2::Audio static FLAC__StreamDecoderLengthStatus FlacCallbackLength( const FLAC__StreamDecoder* decoder, FLAC__uint64* streamLength, void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); auto pos = SDL_RWtell(self->_rw); auto length = SDL_RWseek(self->_rw, 0, RW_SEEK_END); if (SDL_RWseek(self->_rw, pos, RW_SEEK_SET) != pos || length < 0) @@ -239,7 +239,7 @@ namespace OpenRCT2::Audio static FLAC__bool FlacCallbackEof(const FLAC__StreamDecoder* decoder, void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); auto pos = SDL_RWtell(self->_rw); auto end = SDL_RWseek(self->_rw, 0, RW_SEEK_END); if (pos == end) @@ -256,7 +256,7 @@ namespace OpenRCT2::Audio static FLAC__StreamDecoderWriteStatus FlacCallbackWrite( const FLAC__StreamDecoder* decoder, const FLAC__Frame* frame, const FLAC__int32* const buffer[], void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); // Determine sizes auto channels = self->_format.channels; @@ -301,7 +301,7 @@ namespace OpenRCT2::Audio static void FlacCallbackMetadata( const FLAC__StreamDecoder* decoder, const FLAC__StreamMetadata* metadata, void* clientData) { - auto* self = reinterpret_cast(clientData); + auto* self = static_cast(clientData); if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { self->_bitsPerSample = metadata->data.stream_info.bits_per_sample; diff --git a/src/openrct2-ui/audio/MemoryAudioSource.cpp b/src/openrct2-ui/audio/MemoryAudioSource.cpp index 696bd4293f..88dc696d32 100644 --- a/src/openrct2-ui/audio/MemoryAudioSource.cpp +++ b/src/openrct2-ui/audio/MemoryAudioSource.cpp @@ -55,7 +55,7 @@ namespace OpenRCT2::Audio auto src = _data.data(); if (src != nullptr) { - std::copy_n(src + offset, bytesToRead, reinterpret_cast(dst)); + std::copy_n(src + offset, bytesToRead, static_cast(dst)); } } return bytesToRead; diff --git a/src/openrct2-ui/audio/OggAudioSource.cpp b/src/openrct2-ui/audio/OggAudioSource.cpp index 99f07f046f..3fcf663cbd 100644 --- a/src/openrct2-ui/audio/OggAudioSource.cpp +++ b/src/openrct2-ui/audio/OggAudioSource.cpp @@ -101,7 +101,7 @@ namespace OpenRCT2::Audio } auto readLen = static_cast(len); - auto dst8 = reinterpret_cast(dst); + auto dst8 = static_cast(dst); int64_t totalBytesRead{}; int64_t bytesRead; do @@ -139,17 +139,17 @@ namespace OpenRCT2::Audio private: static size_t VorbisCallbackRead(void* ptr, size_t size, size_t nmemb, void* datasource) { - return SDL_RWread(reinterpret_cast(datasource), ptr, size, nmemb); + return SDL_RWread(static_cast(datasource), ptr, size, nmemb); } static int VorbisCallbackSeek(void* datasource, ogg_int64_t offset, int whence) { - return (SDL_RWseek(reinterpret_cast(datasource), offset, whence) < 0) ? -1 : 0; + return (SDL_RWseek(static_cast(datasource), offset, whence) < 0) ? -1 : 0; } static long VorbisCallbackTell(void* datasource) { - return static_cast(SDL_RWtell(reinterpret_cast(datasource))); + return static_cast(SDL_RWtell(static_cast(datasource))); } }; #endif diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 7fd40749ab..d26f5b456c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -29,6 +29,7 @@ #include #include #include + #include #include #include #include @@ -1210,7 +1211,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( right += clip.GetLeft() - rt.x; bottom += clip.GetTop() - rt.y; - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + if (info->colourFlags.has(ColourFlag::withOutline)) { std::array boundsArr = { { { left + 1, top, right + 1, bottom }, @@ -1234,7 +1235,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( command.zoom = 1.0f; } } - if (info->flags & TEXT_DRAW_FLAG_INSET) + if (info->colourFlags.has(ColourFlag::inset)) { DrawRectCommand& command = _commandBuffers.rects.allocate(); command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() }; diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 0de2167bfa..712c66d1b0 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -211,7 +211,7 @@ namespace OpenRCT2 if (scroll.flags & HSCROLLBAR_VISIBLE) { - int16_t size = widget.width() - 1; + int16_t size = widget.width() - 2; if (scroll.flags & VSCROLLBAR_VISIBLE) size -= 11; size = std::max(0, scroll.contentWidth - size); @@ -671,7 +671,7 @@ namespace OpenRCT2 const auto& widg = w.widgets[widgetIndex]; auto& scroll = w.scrolls[scroll_id]; - int32_t widget_width = widg.width() - 1; + int32_t widget_width = widg.width() - 2; if (scroll.flags & VSCROLLBAR_VISIBLE) widget_width -= kScrollBarWidth + 1; int32_t widget_content_width = std::max(scroll.contentWidth - widget_width, 0); @@ -794,7 +794,7 @@ namespace OpenRCT2 int32_t newLeft; newLeft = scroll.contentWidth; newLeft *= x; - x = widget.width() - 21; + x = widget.width() - 22; if (scroll.flags & VSCROLLBAR_VISIBLE) x -= kScrollBarWidth + 1; newLeft /= x; @@ -804,7 +804,7 @@ namespace OpenRCT2 newLeft += x; if (newLeft < 0) newLeft = 0; - x = widget.width() - 1; + x = widget.width() - 2; if (scroll.flags & VSCROLLBAR_VISIBLE) x -= kScrollBarWidth + 1; x *= -1; @@ -891,7 +891,7 @@ namespace OpenRCT2 auto& scroll = w.scrolls[scroll_id]; scroll.flags |= HSCROLLBAR_RIGHT_PRESSED; scroll.contentOffsetX += 3; - int32_t newLeft = widget.width() - 1; + int32_t newLeft = widget.width() - 2; if (scroll.flags & VSCROLLBAR_VISIBLE) newLeft -= kScrollBarWidth + 1; newLeft *= -1; @@ -1466,6 +1466,11 @@ namespace OpenRCT2 int32_t dropdown_index = DropdownIndexFromPoint(screenCoords, w); if (dropdown_index == -1) { + if (gDropdown.hasTooltips && gDropdown.lastTooltipHover != -1) + { + gDropdown.lastTooltipHover = -1; + WindowTooltipClose(); + } return; } diff --git a/src/openrct2-ui/interface/Dropdown.h b/src/openrct2-ui/interface/Dropdown.h index ca977cf1c3..ccb41849a7 100644 --- a/src/openrct2-ui/interface/Dropdown.h +++ b/src/openrct2-ui/interface/Dropdown.h @@ -20,8 +20,9 @@ struct ImageId; namespace OpenRCT2 { + struct ColourWithFlags; class Formatter; -} +} // namespace OpenRCT2 namespace OpenRCT2::Dropdown { diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index a56d97a2e3..6c737fb909 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,7 @@ namespace OpenRCT2::Graph char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), fmt, curLabel); DrawText( - rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::Small, TextAlignment::RIGHT }, + rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::small, TextAlignment::right }, buffer); // Draw Y label tick mark Rectangle::fill( @@ -69,7 +70,7 @@ namespace OpenRCT2::Graph ft.Add(DateGameShortMonthNames[DateGetMonth((yearOver32 / 4) + MONTH_COUNT)]); DrawTextBasic( rt, screenCoords - ScreenCoordsXY{ 0, 14 }, STR_GRAPH_LABEL, ft, - { FontStyle::Small, TextAlignment::CENTRE }); + { FontStyle::small, TextAlignment::centre }); // Draw month tick mark Rectangle::fill( rt, { screenCoords - ScreenCoordsXY{ 0, 4 }, screenCoords - ScreenCoordsXY{ 0, 1 } }, PaletteIndex::pi10); @@ -100,7 +101,7 @@ namespace OpenRCT2::Graph kDashLength, PaletteIndex::pi10); GfxDrawDashedLine(rt, { { bounds.GetLeft(), coords.y }, coords }, kDashLength, PaletteIndex::pi10); - DrawText(rt, coords - ScreenCoordsXY{ 0, 16 }, { textCol, TextAlignment::CENTRE }, text); + DrawText(rt, coords - ScreenCoordsXY{ 0, 16 }, { textCol, TextAlignment::centre }, text); Rectangle::fill(rt, { { coords - ScreenCoordsXY{ 2, 2 } }, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10); Rectangle::fill(rt, { { coords - ScreenCoordsXY{ 1, 1 } }, { coords + ScreenCoordsXY{ 1, 1 } } }, PaletteIndex::pi21); diff --git a/src/openrct2-ui/interface/Graph.h b/src/openrct2-ui/interface/Graph.h index 43914c8fff..9d0d637150 100644 --- a/src/openrct2-ui/interface/Graph.h +++ b/src/openrct2-ui/interface/Graph.h @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace OpenRCT2::Graph diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index ef5b1a7104..1c2c85685b 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ static InGameConsole _inGameConsole; static FontStyle InGameConsoleGetFontStyle() { - return (Config::Get().interface.consoleSmallFont ? FontStyle::Small : FontStyle::Medium); + return (Config::Get().interface.consoleSmallFont ? FontStyle::small : FontStyle::medium); } static int32_t InGameConsoleGetLineHeight() @@ -298,7 +299,7 @@ void InGameConsole::Draw(RenderTarget& rt) const return; // Set font - ColourWithFlags textColour = { ThemeGetColour(WindowClass::console, 1).colour, 0 }; + ColourWithFlags textColour = { ThemeGetColour(WindowClass::console, 1).colour, {} }; const FontStyle style = InGameConsoleGetFontStyle(); const int32_t lineHeight = InGameConsoleGetLineHeight(); const int32_t maxLines = GetNumVisibleLines(); @@ -306,7 +307,7 @@ void InGameConsole::Draw(RenderTarget& rt) const // TTF looks far better without the outlines if (!LocalisationService_UseTrueTypeFont()) { - textColour.setFlag(ColourFlag::withOutline, true); + textColour.flags.set(ColourFlag::withOutline, true); } Invalidate(); diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index 3dbe710cf7..19e126415b 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ namespace OpenRCT2::Ui } static constexpr ColourWithFlags translucent(colour_t colour) { - return ColourWithFlags{ colour, EnumToFlag(ColourFlag::translucent) }; + return ColourWithFlags{ colour, { ColourFlag::translucent } }; } static constexpr WindowThemeDesc kWindowThemeDescriptors[] = @@ -322,7 +323,7 @@ namespace OpenRCT2::Ui for (uint8_t i = 0; i < wtDesc->windowColours.numColours; i++) { json_t jsonEntry = { { "colour", Colour::ToString(Theme.Colours[i].colour) }, - { "translucent", Theme.Colours[i].hasFlag(ColourFlag::translucent) } }; + { "translucent", Theme.Colours[i].flags.has(ColourFlag::translucent) } }; jsonColours.emplace_back(jsonEntry); } @@ -364,7 +365,8 @@ namespace OpenRCT2::Ui auto colourObject = Json::AsObject(jsonColours[i]); auto colour = Colour::FromString(Json::GetString(colourObject["colour"]), COLOUR_BLACK); auto isTranslucent = Json::GetBoolean(colourObject["translucent"], false); - uint8_t flags = isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0; + ColourFlags flags{}; + flags.set(ColourFlag::translucent, isTranslucent); result.Theme.Colours[i] = { colour, flags }; } diff --git a/src/openrct2-ui/interface/Theme.h b/src/openrct2-ui/interface/Theme.h index daafcc6973..67840fd5a0 100644 --- a/src/openrct2-ui/interface/Theme.h +++ b/src/openrct2-ui/interface/Theme.h @@ -12,6 +12,11 @@ #include #include +namespace OpenRCT2 +{ + struct ColourWithFlags; +} + namespace OpenRCT2::Ui { enum diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 0c9c3476f4..b434001f4b 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -357,9 +358,9 @@ namespace OpenRCT2::Ui return; auto colour = w.colours[widget.colour]; - colour.setFlag(ColourFlag::translucent, false); + colour.flags.set(ColourFlag::translucent, false); if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); // Resolve the absolute ltrb auto topLeft = w.windowPos + ScreenCoordsXY{ widget.left, 0 }; @@ -381,11 +382,11 @@ namespace OpenRCT2::Ui ScreenCoordsXY coords = { (topLeft.x + r + 1) / 2 - 1, topLeft.y }; if (widget.type == WidgetType::labelCentred) { - DrawTextWrapped(rt, coords, widget.width() - 2, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextWrapped(rt, coords, widget.width() - 3, stringId, ft, { colour, TextAlignment::centre }); } else { - DrawTextEllipsised(rt, coords, widget.width() - 2, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextEllipsised(rt, coords, widget.width() - 3, stringId, ft, { colour, TextAlignment::centre }); } } @@ -403,7 +404,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); // Resolve the absolute ltrb int32_t l = w.windowPos.x + widget.left; @@ -429,7 +430,7 @@ namespace OpenRCT2::Ui ScreenCoordsXY coords = { l + 1, t }; if (widget.type == WidgetType::labelCentred) { - DrawTextWrapped(rt, coords, r - l, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextWrapped(rt, coords, r - l, stringId, ft, { colour, TextAlignment::centre }); } else { @@ -492,7 +493,7 @@ namespace OpenRCT2::Ui { auto colour = w.colours[widget.colour].withFlag(ColourFlag::translucent, false); if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); utf8 buffer[512] = { 0 }; OpenRCT2::FormatStringLegacy(buffer, sizeof(buffer), stringId, rawFt.Data()); @@ -500,7 +501,7 @@ namespace OpenRCT2::Ui auto ft = Formatter(); ft.Add(buffer); DrawTextBasic(rt, { l, t }, STR_STRING, ft, { colour }); - textRight = l + GfxGetStringWidth(buffer, FontStyle::Medium) + 1; + textRight = l + GfxGetStringWidth(buffer, FontStyle::medium) + 1; } // Border @@ -571,7 +572,7 @@ namespace OpenRCT2::Ui return; topLeft = w.windowPos + ScreenCoordsXY{ widget->left + 2, widget->top + 1 }; - int32_t width = widget->width() - 4; + int32_t width = widget->width() - 5; if (static_cast(widgetIndex + 1) < w.widgets.size() && (w.widgets[widgetIndex + 1]).type == WidgetType::closeBox) @@ -589,7 +590,7 @@ namespace OpenRCT2::Ui DrawTextEllipsised( rt, topLeft, width, widget->text, Formatter::Common(), - { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::CENTRE }); + { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre }); } /** @@ -624,9 +625,9 @@ namespace OpenRCT2::Ui topLeft = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, std::max(widget.top, widget.midY() - 5) }; if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); - DrawText(rt, topLeft, { colour, TextAlignment::CENTRE }, widget.string); + DrawText(rt, topLeft, { colour, TextAlignment::centre }, widget.string); } /** @@ -652,7 +653,7 @@ namespace OpenRCT2::Ui if (widgetIsDisabled(w, widgetIndex)) { - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); } // fill it when checkbox is pressed @@ -676,7 +677,7 @@ namespace OpenRCT2::Ui } DrawTextEllipsised( - rt, w.windowPos + ScreenCoordsXY{ widget.left + 14, widget.textTop() }, widget.width() - 14, stringId, ft, colour); + rt, w.windowPos + ScreenCoordsXY{ widget.left + 14, widget.textTop() }, widget.width() - 15, stringId, ft, colour); } /** @@ -707,7 +708,7 @@ namespace OpenRCT2::Ui bottomRight.x--; bottomRight.y--; - bool hScrollNeeded = scroll.contentWidth > widget.width() && (scroll.flags & HSCROLLBAR_VISIBLE); + bool hScrollNeeded = scroll.contentWidth > (widget.width() - 1) && (scroll.flags & HSCROLLBAR_VISIBLE); bool vScrollNeeded = scroll.contentHeight > widget.height() && (scroll.flags & VSCROLLBAR_VISIBLE); // Horizontal scrollbar @@ -762,7 +763,7 @@ namespace OpenRCT2::Ui static void WidgetHScrollbarDraw( RenderTarget& rt, const ScrollArea& scroll, int32_t l, int32_t t, int32_t r, int32_t b, ColourWithFlags colour) { - colour.setFlag(ColourFlag::translucent, false); + colour.flags.set(ColourFlag::translucent, false); // Trough Rectangle::fill(rt, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, ColourMapA[colour.colour].lighter); @@ -809,7 +810,7 @@ namespace OpenRCT2::Ui static void WidgetVScrollbarDraw( RenderTarget& rt, const ScrollArea& scroll, int32_t l, int32_t t, int32_t r, int32_t b, ColourWithFlags colour) { - colour.setFlag(ColourFlag::translucent, false); + colour.flags.set(ColourFlag::translucent, false); // Trough Rectangle::fill(rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); @@ -981,7 +982,7 @@ namespace OpenRCT2::Ui } const auto& scroll = w.scrolls[*scroll_id]; - if ((scroll.flags & HSCROLLBAR_VISIBLE) && scroll.contentWidth > widget->width() + if ((scroll.flags & HSCROLLBAR_VISIBLE) && scroll.contentWidth > (widget->width() - 1) && screenCoords.y >= (w.windowPos.y + widget->bottom - (kScrollBarWidth + 1))) { // horizontal scrollbar @@ -1173,7 +1174,7 @@ namespace OpenRCT2::Ui if (widget.text != 0) { u8string wrappedString; - GfxWrapString(widget.string, bottomRight.x - topLeft.x - 5, FontStyle::Medium, &wrappedString, nullptr); + GfxWrapString(widget.string, bottomRight.x - topLeft.x - 5, FontStyle::medium, &wrappedString, nullptr); DrawText(rt, { topLeft.x + 2, topLeft.y }, { w.colours[1] }, wrappedString.c_str(), true); } return; @@ -1182,7 +1183,7 @@ namespace OpenRCT2::Ui // String length needs to add 12 either side of box // +13 for cursor when max length. u8string wrappedString; - GfxWrapString(*textInput->Buffer, bottomRight.x - topLeft.x - 5 - 6, FontStyle::Medium, &wrappedString, nullptr); + GfxWrapString(*textInput->Buffer, bottomRight.x - topLeft.x - 5 - 6, FontStyle::medium, &wrappedString, nullptr); DrawText(rt, { topLeft.x + 2, topLeft.y }, { w.colours[1] }, wrappedString.c_str(), true); @@ -1190,7 +1191,7 @@ namespace OpenRCT2::Ui int32_t curX = topLeft.x + GfxGetStringWidthNoFormatting( u8string_view{ wrappedString.c_str(), std::min(wrappedString.length(), textInput->SelectionStart) }, - FontStyle::Medium) + FontStyle::medium) + 3; int32_t width = 6; @@ -1199,7 +1200,7 @@ namespace OpenRCT2::Ui // Make a new 1 character wide string for measuring the width // of the character that the cursor is under. (NOTE: this is broken for multi byte utf8 codepoints) width = std::max( - GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::Medium) + GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::medium) - 2, 4); } @@ -1235,7 +1236,7 @@ namespace OpenRCT2::Ui return; } - const auto barWidth = widget.width() - 2; + const auto barWidth = widget.width() - 3; const int32_t fillSize = (barWidth * percentage) / 100; if (fillSize > 0) { @@ -1282,7 +1283,7 @@ namespace OpenRCT2::Ui if (scroll.flags & HSCROLLBAR_VISIBLE) { - int32_t view_size = widget.width() - 21; + int32_t view_size = widget.width() - 22; if (scroll.flags & VSCROLLBAR_VISIBLE) view_size -= 11; int32_t x = scroll.contentOffsetX * view_size; @@ -1290,7 +1291,7 @@ namespace OpenRCT2::Ui x /= scroll.contentWidth; scroll.hThumbLeft = x + 11; - x = widget.width() - 2; + x = widget.width() - 3; if (scroll.flags & VSCROLLBAR_VISIBLE) x -= 11; x += scroll.contentOffsetX; diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 47ef4eef48..a7c1d77329 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -102,7 +102,7 @@ namespace OpenRCT2::Ui } else { - int32_t size = widget->width() - 1; + int32_t size = widget->width() - 2; if (scroll.flags & VSCROLLBAR_VISIBLE) size -= 11; size = std::max(0, scroll.contentWidth - size); @@ -492,7 +492,7 @@ namespace OpenRCT2::Ui 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(); + int32_t tab_width = w->widgets[start_tab_id].width() - 1; for (i = start_tab_id; i <= end_tab_id; i++) { diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 7dc92a811a..add4be58e9 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -696,13 +696,13 @@ void CustomListView::PaintHeading( { auto ft = Formatter(); ft.Add(STR_UP); - DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::right }); } else if (sortOrder == ColumnSortOrder::Descending) { auto ft = Formatter(); ft.Add(STR_DOWN); - DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::right }); } } @@ -724,12 +724,12 @@ void CustomListView::PaintSeparator(RenderTarget& rt, const ScreenCoordsXY& pos, // Draw string Formatter ft; ft.Add(text); - DrawTextBasic(rt, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::centre }); // Get string dimensions utf8 stringBuffer[512]{}; FormatStringLegacy(stringBuffer, sizeof(stringBuffer), STR_STRING, ft.Data()); - int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::Medium) / 2) + 4; + int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::medium) / 2) + 4; int32_t strLeft = centreX - categoryStringHalfWidth; int32_t strRight = centreX + categoryStringHalfWidth; diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 6e786ef75e..7b48af5fc7 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -23,6 +23,7 @@ #include #include #include + #include #include #include #include @@ -157,7 +158,7 @@ namespace OpenRCT2::Ui::Windows result.Text = ProcessString(desc["text"]); if (ProcessString(desc["textAlign"]) == "centred") { - result.TextAlign = TextAlignment::CENTRE; + result.TextAlign = TextAlignment::centre; } } else if (result.Type == "listview") @@ -318,9 +319,9 @@ namespace OpenRCT2::Ui::Windows if (w.type() == DukValue::Type::NUMBER) { colour_t colour = w.as_uint() & ~kLegacyColourFlagTranslucent; - auto isTranslucent = (w.as_uint() & kLegacyColourFlagTranslucent); + bool isTranslucent = (w.as_uint() & kLegacyColourFlagTranslucent); c.colour = std::clamp(colour, COLOUR_BLACK, COLOUR_COUNT - 1); - c.flags = (isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0); + c.flags.set(ColourFlag::translucent, isTranslucent); } return c; }); @@ -488,7 +489,7 @@ namespace OpenRCT2::Ui::Windows void onPrepareDraw() override { auto& closeButton = widgets[WIDX_CLOSE]; - bool translucent = colours[closeButton.colour].hasFlag(ColourFlag::translucent); + bool translucent = colours[closeButton.colour].flags.has(ColourFlag::translucent); if (Config::Get().interface.enlargedUi) closeButton.string = !translucent ? kCloseBoxStringBlackLarge : kCloseBoxStringWhiteLarge; else @@ -518,7 +519,7 @@ namespace OpenRCT2::Ui::Windows if (widget.type == WidgetType::scroll) { auto& listView = _info.ListViews[scrollIndex]; - auto wwidth = widget.width() + 1 - 2; + auto wwidth = widget.width() - 2; auto wheight = widget.height() + 1 - 2; if (listView.GetScrollbars() == ScrollbarType::Horizontal || listView.GetScrollbars() == ScrollbarType::Both) @@ -560,7 +561,7 @@ namespace OpenRCT2::Ui::Windows { RenderTarget widgetDpi; if (ClipDrawPixelInfo( - widgetDpi, rt, { windowPos.x + widget.left, windowPos.y + widget.top }, widget.width(), + widgetDpi, rt, { windowPos.x + widget.left, windowPos.y + widget.top }, widget.width() - 1, widget.height())) { auto ctx = onDraw.context(); @@ -653,7 +654,7 @@ namespace OpenRCT2::Ui::Windows } WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, - colours[widget->colour], 0, Dropdown::Flag::StayOpen, numItems, widget->width() - 3); + colours[widget->colour], 0, Dropdown::Flag::StayOpen, numItems, widget->width() - 4); if (selectedIndex >= 0 && selectedIndex < static_cast(numItems)) gDropdown.items[selectedIndex].setChecked(true); @@ -808,7 +809,7 @@ namespace OpenRCT2::Ui::Windows { auto left = windowPos.x + viewportWidget->left + 1; auto top = windowPos.y + viewportWidget->top + 1; - auto wwidth = viewportWidget->width() - 1; + auto wwidth = viewportWidget->width() - 2; auto wheight = viewportWidget->height() - 1; if (viewport == nullptr) { @@ -1053,7 +1054,7 @@ namespace OpenRCT2::Ui::Windows widget.type = WidgetType::label; widget.string = const_cast(desc.Text.c_str()); widget.flags.set(WidgetFlag::textIsString); - if (desc.TextAlign == TextAlignment::CENTRE) + if (desc.TextAlign == TextAlignment::centre) { widget.type = WidgetType::labelCentred; } diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index 02db09929d..b40278c2ae 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -159,8 +159,8 @@ namespace OpenRCT2::Scripting DukValue measureText(const std::string& text) { - auto width = GfxGetStringWidth(text, FontStyle::Medium); - auto height = StringGetHeightRaw(text.c_str(), FontStyle::Medium); + auto width = GfxGetStringWidth(text, FontStyle::medium); + auto height = StringGetHeightRaw(text.c_str(), FontStyle::medium); return ToDuk(_ctx, { width, height }); } diff --git a/src/openrct2-ui/scripting/ScWidget.hpp b/src/openrct2-ui/scripting/ScWidget.hpp index d12f02f96d..7f3ce90aa5 100644 --- a/src/openrct2-ui/scripting/ScWidget.hpp +++ b/src/openrct2-ui/scripting/ScWidget.hpp @@ -211,7 +211,7 @@ namespace OpenRCT2::Scripting auto widget = GetWidget(); if (widget != nullptr) { - return widget->width() + 1; + return widget->width(); } return 0; } diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp index 93abaafb9e..32d7e67dc0 100644 --- a/src/openrct2-ui/scripting/ScWindow.hpp +++ b/src/openrct2-ui/scripting/ScWindow.hpp @@ -13,6 +13,7 @@ #include "ScWidget.hpp" + #include #include #include #include @@ -238,7 +239,7 @@ namespace OpenRCT2::Scripting for (auto c : w->colours) { auto colour = c.colour; - if (c.hasFlag(ColourFlag::translucent)) + if (c.flags.has(ColourFlag::translucent)) colour |= kLegacyColourFlagTranslucent; result.push_back(colour); } @@ -256,9 +257,9 @@ namespace OpenRCT2::Scripting if (i < colours.size()) { colour_t colour = colours[i] & ~kLegacyColourFlagTranslucent; - auto isTranslucent = (colours[i] & kLegacyColourFlagTranslucent); + bool isTranslucent = (colours[i] & kLegacyColourFlagTranslucent); c.colour = std::clamp(colour, COLOUR_BLACK, COLOUR_COUNT - 1); - c.flags = (isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0); + c.flags.set(ColourFlag::translucent, isTranslucent); } w->colours[i] = c; } diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 09f3cce5ad..135660010f 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -165,14 +165,14 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_TITLE_SEQUENCE_OPENRCT2); DrawTextWrapped( rt, aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, - { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + { COLOUR_AQUAMARINE, TextAlignment::centre }); } { // TODO: this string shouldn't be reused for this tab auto ft = Formatter(); ft.Add(STR_TITLE_SEQUENCE_RCT2); DrawTextWrapped( - rt, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + rt, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::centre }); } int32_t newHeight = 0; @@ -232,9 +232,9 @@ namespace OpenRCT2::Ui::Windows const auto& versionWidget = widgets[WIDX_VERSION]; auto centreX = versionWidget.midX(); - auto centreY = versionWidget.midY() - FontGetLineHeight(FontStyle::Medium) / 2; + auto centreY = versionWidget.midY() - FontGetLineHeight(FontStyle::medium) / 2; auto centrePos = windowPos + ScreenCoordsXY(centreX, centreY); - DrawTextWrapped(rt, centrePos, versionWidget.width(), STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); + DrawTextWrapped(rt, centrePos, versionWidget.width() - 1, STR_STRING, ft, { colours[1], TextAlignment::centre }); // Shows the update available button if (OpenRCT2::GetContext()->HasNewVersionInfo()) @@ -243,7 +243,7 @@ namespace OpenRCT2::Ui::Windows } // Draw the rest of the text - TextPaint tp{ colours[1], TextAlignment::CENTRE }; + TextPaint tp{ colours[1], TextAlignment::centre }; auto textCoords = windowPos + ScreenCoordsXY((width / 2) - 1, 240); auto textWidth = kWindowSize.width - (kPadding * 2); for (auto stringId : _OpenRCT2InfoStrings) @@ -257,7 +257,7 @@ namespace OpenRCT2::Ui::Windows auto& backgroundWidget = widgets[WIDX_PAGE_BACKGROUND]; auto textCoords = windowPos + ScreenCoordsXY{ backgroundWidget.midX(), backgroundWidget.top + kPadding }; auto textWidth = kWindowSize.width - 20; - TextPaint tp{ colours[1], TextAlignment::CENTRE }; + TextPaint tp{ colours[1], TextAlignment::centre }; // Draw credits for (auto stringId : _RCT2InfoStrings) diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index c3af927081..649a7e8647 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -88,7 +88,7 @@ namespace OpenRCT2::Ui::Windows const auto& viewportWidget = widgets[WIDX_VIEWPORT]; ViewportCreate( *this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, - (viewportWidget.width()) - 1, (viewportWidget.height()) - 1, Focus(_bannerViewPos)); + viewportWidget.width() - 2, (viewportWidget.height()) - 1, Focus(_bannerViewPos)); if (viewport != nullptr) viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; @@ -177,7 +177,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { widget->left + windowPos.x, widget->top + windowPos.y }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, numItems, widget->width() + 3); + Dropdown::Flag::StayOpen, numItems, widget->width() - 1 + 3); gDropdown.items[EnumValue(banner->textColour) - 1].setChecked(true); break; diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 6e2aa2d371..cc61d724df 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -142,7 +142,7 @@ namespace OpenRCT2::Ui::Windows { SetResizeDimensions(); - auto downloadButtonWidth = widgets[WIDX_OPEN_URL].width(); + auto downloadButtonWidth = widgets[WIDX_OPEN_URL].width() - 1; widgets[WIDX_OPEN_URL].left = (width - downloadButtonWidth) / 2; widgets[WIDX_OPEN_URL].right = widgets[WIDX_OPEN_URL].left + downloadButtonWidth; } @@ -177,7 +177,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + const int32_t lineHeight = FontGetLineHeight(FontStyle::medium); ScreenCoordsXY screenCoords(3, 3 - lineHeight); for (const auto& line : _changelogLines) @@ -194,7 +194,7 @@ namespace OpenRCT2::Ui::Windows { return ScreenSize( _changelogLongestLineWidth + 4, - static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium)); + static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::medium)); } private: @@ -271,7 +271,7 @@ namespace OpenRCT2::Ui::Windows _changelogLongestLineWidth = 0; for (const auto& line : _changelogLines) { - int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::Medium); + int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::medium); _changelogLongestLineWidth = std::max(linewidth, _changelogLongestLineWidth); } } diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index f016f3e523..8f954e9dfd 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -608,7 +608,7 @@ static StringId window_cheats_page_titles[] = { ft.Add(_moneySpinnerValue); if (isWidgetDisabled(WIDX_MONEY_SPINNER)) { - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); } auto& widget = widgets[WIDX_MONEY_SPINNER]; @@ -630,20 +630,20 @@ static StringId window_cheats_page_titles[] = { ft.Add(_yearSpinnerValue); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ _xRcol, yearBox.top + 2 }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); ft = Formatter(); int32_t actual_month = _monthSpinnerValue - 1; ft.Add(actual_month); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ _xRcol, monthBox.top + 2 }, STR_FORMAT_MONTH, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); ft = Formatter(); ft.Add(_daySpinnerValue); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ _xRcol, dayBox.top + 2 }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); } else if (page == WINDOW_CHEATS_PAGE_PARK) { @@ -995,7 +995,7 @@ static StringId window_cheats_page_titles[] = { WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); + colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 4); gDropdown.items[EnumValue(gameState.cheats.selectedStaffSpeed)].setChecked(true); } } @@ -1017,7 +1017,7 @@ static StringId window_cheats_page_titles[] = { } WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 3); + colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 4); auto currentWeather = gameState.weatherCurrent.weatherType; gDropdown.items[EnumValue(currentWeather)].setChecked(true); diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 5286ee8aa8..6cddde3b3f 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } // Draw cost amount @@ -194,7 +194,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_clearSceneryCost); screenCoords.x = widgets[WIDX_PREVIEW].midX() + windowPos.x; screenCoords.y = widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27; - DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index ab8f25dfe5..e4e5e397b5 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -92,7 +92,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 2, widget->width() - 3); + Dropdown::Flag::StayOpen, 2, widget->width() - 4); if (CurrencyDescriptors[EnumValue(CurrencyType::custom)].affix_unicode == CurrencyAffix::prefix) { diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index 74f8370998..c15f9caae3 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -124,7 +125,7 @@ namespace OpenRCT2::Ui::Windows const auto& stringIdx = widgets[widgetIndex].text; auto string = ls.GetString(stringIdx); Guard::ArgumentNotNull(string); - const auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); + const auto strWidth = GfxGetStringWidth(string, FontStyle::medium); newWidth = std::max(strWidth, newWidth); } diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index dc4219a39f..8d8bfafcef 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -87,7 +87,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_demolishRideCost); ScreenCoordsXY stringCoords(windowPos.x + kWindowSize.width / 2, windowPos.y + (kWindowSize.height / 2) - 3); - DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::centre }); } } }; diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 0e5f4f8c64..2227a1d818 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -94,7 +95,7 @@ namespace OpenRCT2::Ui::Windows if (highlighted) colour.colour = COLOUR_WHITE; if (item.isDisabled()) - colour = { background, EnumToFlag(ColourFlag::inset) }; + colour = { background, { ColourFlag::inset } }; auto yOffset = GetAdditionalRowPadding(); Formatter ft; @@ -125,7 +126,7 @@ namespace OpenRCT2::Ui::Windows const auto rightBottom = leftTop + ScreenCoordsXY{ ItemWidth - 4, 0 }; const auto shadowOffset = ScreenCoordsXY{ 0, 1 }; - if (colours[0].hasFlag(ColourFlag::translucent)) + if (colours[0].flags.has(ColourFlag::translucent)) { TranslucentWindowPalette palette = kTranslucentWindowPalettes[colours[0].colour]; Rectangle::filter(rt, { leftTop, rightBottom }, palette.highlight); @@ -231,7 +232,7 @@ namespace OpenRCT2::Ui::Windows UpdateSizeAndPosition(screenPos, extraY); - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) flags |= WindowFlag::transparent; colours[0] = colour; } @@ -264,7 +265,7 @@ namespace OpenRCT2::Ui::Windows UpdateSizeAndPosition(screenPos, extraY); - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) flags |= WindowFlag::transparent; colours[0] = colour; } @@ -354,7 +355,7 @@ namespace OpenRCT2::Ui::Windows int32_t maxStringWidth = 0; for (size_t i = 0; i < num_items; i++) { - int32_t stringWidth = GfxGetStringWidth(gDropdown.items[i].text, FontStyle::Medium); + int32_t stringWidth = GfxGetStringWidth(gDropdown.items[i].text, FontStyle::medium); if (gDropdown.items[i].type != Dropdown::ItemType::plain) stringWidth += kDropdownItemLeftPadding; maxStringWidth = std::max(stringWidth, maxStringWidth); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index e180bca9c2..5f281d28e2 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -370,8 +370,8 @@ namespace OpenRCT2::Ui::Windows if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; - DrawTextBasic(rt, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE }); - DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::centre }); + DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre }); } void DrawRightButtonBack(RenderTarget& rt) @@ -411,8 +411,8 @@ namespace OpenRCT2::Ui::Windows if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; - DrawTextBasic(rt, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE }); - DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::centre }); + DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre }); } void DrawStepText(RenderTarget& rt) @@ -422,7 +422,7 @@ namespace OpenRCT2::Ui::Windows auto colour = colours[2].withFlag(ColourFlag::translucent, false).withFlag(ColourFlag::withOutline, true); DrawTextBasic( rt, { stateX, stateY }, kEditorStepNames[EnumValue(getGameState().editorStep)], {}, - { colour, TextAlignment::CENTRE }); + { colour, TextAlignment::centre }); } static constexpr FuncPtr kPreviousButtonMouseUp[] = { diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 72c7747b02..4d7f8615bd 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -276,7 +277,7 @@ namespace OpenRCT2::Ui::Windows uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light; GfxClear(rt, paletteIndex); - int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width(); + int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width() - 1; int32_t itemY = -kScrollableRowHeight; auto* dragItem = WindowEditorInventionsListDragGetItem(); @@ -312,15 +313,15 @@ namespace OpenRCT2::Ui::Windows // TODO: this parameter by itself produces very light text. // It needs a {BLACK} token in the string to work properly. ColourWithFlags colour = { COLOUR_BLACK }; - FontStyle fontStyle = FontStyle::Medium; - auto darkness = TextDarkness::Regular; + FontStyle fontStyle = FontStyle::medium; + auto darkness = TextDarkness::regular; if (researchItem.IsAlwaysResearched()) { if (_selectedResearchItem == &researchItem && dragItem == nullptr) - darkness = TextDarkness::ExtraDark; + darkness = TextDarkness::extraDark; else - darkness = TextDarkness::Dark; + darkness = TextDarkness::dark; colour = colours[1].withFlag(ColourFlag::inset, true); } @@ -401,7 +402,7 @@ namespace OpenRCT2::Ui::Windows { RenderTarget clipDPI; screenPos = windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 }; - const auto clipWidth = bkWidget.width() - 1; + const auto clipWidth = bkWidget.width() - 2; const auto clipHeight = bkWidget.height() - 1; if (ClipDrawPixelInfo(clipDPI, rt, screenPos, clipWidth, clipHeight)) { @@ -431,7 +432,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(stringId); } - DrawTextEllipsised(rt, screenPos, itemWidth, drawString, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, itemWidth, drawString, ft, { TextAlignment::centre }); screenPos.y += 15; // Item category diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index a44b487dd8..0a41de0b54 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -761,12 +761,12 @@ namespace OpenRCT2::Ui::Windows && (*listItem.flags & ObjectSelectionFlags::Selected)) { screenCoords.x = 2; - auto darkness = highlighted ? TextDarkness::ExtraDark : TextDarkness::Dark; + auto darkness = highlighted ? TextDarkness::extraDark : TextDarkness::dark; auto colour2 = colours[1].withFlag(ColourFlag::translucent, false); if (*listItem.flags & (ObjectSelectionFlags::InUse | ObjectSelectionFlags::AlwaysRequired)) - colour2.setFlag(ColourFlag::inset, true); + colour2.flags.set(ColourFlag::inset, true); - DrawText(rt, screenCoords, { colour2, FontStyle::Medium, darkness }, kCheckMarkString); + DrawText(rt, screenCoords, { colour2, FontStyle::medium, darkness }, kCheckMarkString); } screenCoords.x = gLegacyScene == LegacyScene::trackDesignsManager ? 0 : 15; @@ -776,14 +776,14 @@ namespace OpenRCT2::Ui::Windows auto buffer = strchr(bufferWithColour, '\0'); colour_t colour = COLOUR_BLACK; - auto darkness = TextDarkness::Regular; + auto darkness = TextDarkness::regular; if (*listItem.flags & ObjectSelectionFlags::Flag6) { colour = colours[1].colour; - darkness = TextDarkness::Dark; + darkness = TextDarkness::dark; } - int32_t width_limit = widgets[WIDX_LIST].width() - screenCoords.x; + int32_t width_limit = widgets[WIDX_LIST].width() - 1 - screenCoords.x; if (ridePage) { @@ -794,7 +794,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(itemBuffer); DrawTextEllipsised( - rt, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); + rt, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::medium, darkness }); screenCoords.x = widgets[WIDX_LIST_SORT_RIDE].left - widgets[WIDX_LIST].left; } @@ -809,7 +809,7 @@ namespace OpenRCT2::Ui::Windows } auto ft = Formatter(); ft.Add(itemBuffer); - DrawTextEllipsised(rt, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); + DrawTextEllipsised(rt, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::medium, darkness }); } screenCoords.y += kScrollableRowHeight; } @@ -859,7 +859,7 @@ namespace OpenRCT2::Ui::Windows auto& dropdownWidget = widgets[WIDX_FILTER_DROPDOWN]; resizeDropdown(WIDX_FILTER_DROPDOWN, { width - kFilterWidth - 10, dropdownWidget.top }, { kFilterWidth, 14 }); auto& installTrackWidget = widgets[WIDX_INSTALL_TRACK]; - installTrackWidget.moveToX(dropdownWidget.left - installTrackWidget.width() - 10); + installTrackWidget.moveToX(dropdownWidget.left - installTrackWidget.width() - 11); // Set pressed widgets pressedWidgets |= 1uLL << WIDX_PREVIEW; @@ -978,7 +978,7 @@ namespace OpenRCT2::Ui::Windows bool isRideTab = GetSelectedObjectType() == ObjectType::ride; if (isRideTab) { - int32_t width_limit = (widgets[WIDX_LIST].width() - 15) / 2; + int32_t width_limit = (widgets[WIDX_LIST].width() - 16) / 2; widgets[WIDX_LIST_SORT_TYPE].type = WidgetType::tableHeader; widgets[WIDX_LIST_SORT_TYPE].top = widgets[WIDX_FILTER_TEXT_BOX].bottom + 3; @@ -1091,7 +1091,7 @@ namespace OpenRCT2::Ui::Windows : kStringIdNone; ft.Add(stringId); auto screenPos = windowPos + ScreenCoordsXY{ listSortTypeWidget.left + 1, listSortTypeWidget.top + 1 }; - DrawTextEllipsised(rt, screenPos, listSortTypeWidget.width(), STR_OBJECTS_SORT_TYPE, ft, { colours[1] }); + DrawTextEllipsised(rt, screenPos, listSortTypeWidget.width() - 1, STR_OBJECTS_SORT_TYPE, ft, { colours[1] }); } const auto& listSortRideWidget = widgets[WIDX_LIST_SORT_RIDE]; if (listSortRideWidget.type != WidgetType::empty) @@ -1101,7 +1101,7 @@ namespace OpenRCT2::Ui::Windows : kStringIdNone; ft.Add(stringId); auto screenPos = windowPos + ScreenCoordsXY{ listSortRideWidget.left + 1, listSortRideWidget.top + 1 }; - DrawTextEllipsised(rt, screenPos, listSortRideWidget.width(), STR_OBJECTS_SORT_RIDE, ft, { colours[1] }); + DrawTextEllipsised(rt, screenPos, listSortRideWidget.width() - 1, STR_OBJECTS_SORT_RIDE, ft, { colours[1] }); } if (selectedListItem == -1 || _loadedObject == nullptr) @@ -1111,7 +1111,7 @@ namespace OpenRCT2::Ui::Windows { RenderTarget clipDPI; auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 }; - int32_t previewWidth = previewWidget.width() - 1; + int32_t previewWidth = previewWidget.width() - 2; int32_t previewHeight = previewWidget.height() - 1; if (ClipDrawPixelInfo(clipDPI, rt, screenPos, previewWidth, previewHeight)) { @@ -1261,7 +1261,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_STRING); ft.Add(listItem->repositoryItem->Name.c_str()); screenPos.y += DrawTextWrapped( - rt, screenPos, descriptionWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + rt, screenPos, descriptionWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::centre }); // Leave some space between name and description screenPos.y += kListRowHeight; @@ -1364,7 +1364,7 @@ namespace OpenRCT2::Ui::Windows // Draw fallback image warning if (_loadedObject && _loadedObject->UsesFallbackImages()) { - DrawTextBasic(rt, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::right }); } screenPos.y += kListRowHeight; @@ -1372,7 +1372,7 @@ namespace OpenRCT2::Ui::Windows if (GetSelectedObjectType() == ObjectType::ride) { auto stringId = GetRideTypeStringId(listItem->repositoryItem); - DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right }); } // Draw peep animation object type @@ -1380,14 +1380,14 @@ namespace OpenRCT2::Ui::Windows { auto* animObj = reinterpret_cast(_loadedObject.get()); auto stringId = GetAnimationPeepTypeStringId(animObj->GetPeepType()); - DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right }); } screenPos.y += kListRowHeight; // Draw object source auto stringId = ObjectManagerGetSourceGameString(listItem->repositoryItem->GetFirstSourceGame()); - DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right }); screenPos.y += kListRowHeight; // Draw object filename @@ -1398,7 +1398,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(path.c_str()); DrawTextBasic( rt, { windowPos.x + this->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft, - { COLOUR_BLACK, TextAlignment::RIGHT }); + { COLOUR_BLACK, TextAlignment::right }); screenPos.y += kListRowHeight; } @@ -1418,7 +1418,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(authorsString.c_str()); DrawTextEllipsised( rt, { windowPos.x + width - 5, screenPos.y }, width - widgets[WIDX_LIST].right - 4, - STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::RIGHT }); + STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::right }); } } diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 3b9bcc7d5f..d4ef6a34a2 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -767,7 +767,7 @@ namespace OpenRCT2::Ui::Windows Widget* dropdownWidget = &widgets[WIDX_OBJECTIVE]; WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3); + colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4); } void ShowCategoryDropdown() @@ -780,7 +780,7 @@ namespace OpenRCT2::Ui::Windows Widget* dropdownWidget = &widgets[WIDX_CATEGORY]; WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 3); + colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 4); gDropdown.items[EnumValue(getGameState().scenarioOptions.category)].setChecked(true); } @@ -1562,7 +1562,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1, - colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3); + colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 4); if (gameState.park.flags & PARK_FLAGS_UNLOCK_ALL_PRICES) gDropdown.items[2].setChecked(true); @@ -1900,7 +1900,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() - 1, - colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget.width() - 3); + colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget.width() - 4); const auto preferLess = gameState.park.flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES; const auto preferMore = gameState.park.flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES; @@ -2368,9 +2368,9 @@ namespace OpenRCT2::Ui::Windows { if (currentRide->lifecycleFlags & RIDE_LIFECYCLE_INDESTRUCTIBLE) { - auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::ExtraDark : TextDarkness::Dark; + auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::extraDark : TextDarkness::dark; DrawText( - rt, { 2, y }, { colours[1].withFlag(ColourFlag::translucent, false), FontStyle::Medium, darkness }, + rt, { 2, y }, { colours[1].withFlag(ColourFlag::translucent, false), FontStyle::medium, darkness }, kCheckMarkString); } diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 2974fc11c7..dc9762175f 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows WindowDrawWidgets(*this, rt); auto screenCoords = windowPos + ScreenCoordsXY{ (width + 1) / 2 - 1, kPadding - 1 }; - DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::Medium); + DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::medium); } void onPeriodicUpdate() override @@ -126,13 +126,13 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::error); // How wide is the error string? - int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::Medium); + int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::medium); width = std::clamp(width + 2 * kPadding, kMinWidth, kMaxWidth); // How high is the error string? int32_t numLines{}; - GfxWrapString(buffer, width + 1, FontStyle::Medium, &buffer, &numLines); - int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::Medium) + (2 * kPadding); + GfxWrapString(buffer, width + 1, FontStyle::medium, &buffer, &numLines); + int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::medium) + (2 * kPadding); // Position error message around the cursor const CursorState* state = ContextGetCursorState(); diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index a3de9740f4..7d0bd1dd35 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -403,7 +403,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = ScreenCoordsXY{ 0, kTableCellHeight + 2 }; auto& self = widgets[WIDX_SUMMARY_SCROLL]; - int32_t row_width = std::max(scrolls[0].contentWidth, self.width()); + int32_t row_width = std::max(scrolls[0].contentWidth, self.width() - 1); // Expenditure / Income row labels for (int32_t i = 0; i < static_cast(ExpenditureType::count); i++) @@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft, - { TextUnderline::On, TextAlignment::RIGHT }); + { TextUnderline::on, TextAlignment::right }); screenCoords.y += 14; // Month expenditures @@ -452,7 +452,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(expenditure); DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, - { TextAlignment::RIGHT }); + { TextAlignment::right }); } screenCoords.y += kTableCellHeight; } @@ -463,7 +463,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(profit); DrawTextBasic( - rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::RIGHT }); + rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::right }); Rectangle::fill( rt, @@ -597,7 +597,7 @@ namespace OpenRCT2::Ui::Windows // Expenditure / Income heading DrawTextBasic( rt, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, {}, - { COLOUR_BLACK, TextUnderline::On, TextAlignment::LEFT }); + { COLOUR_BLACK, TextUnderline::on, TextAlignment::left }); screenCoords.y += 14; // Expenditure / Income row labels @@ -831,7 +831,7 @@ namespace OpenRCT2::Ui::Windows // dynamic padding for long axis labels: char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{CURRENCY2DP}", centredGraph ? -max : max); - int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1; + int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1; const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y }; _graphBounds = { windowPos + ScreenCoordsXY{ graphPageWidget->left + 4, graphPageWidget->top + 15 }, @@ -847,7 +847,7 @@ namespace OpenRCT2::Ui::Windows void initialiseScrollPosition(WidgetIndex widgetIndex, int32_t scrollId) { const auto& widget = this->widgets[widgetIndex]; - scrolls[scrollId].contentOffsetX = std::max(0, scrolls[scrollId].contentWidth - (widget.width() - 2)); + scrolls[scrollId].contentOffsetX = std::max(0, scrolls[scrollId].contentWidth - (widget.width() - 3)); widgetScrollUpdateThumbs(*this, widgetIndex); } diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 32fed7dc57..fad523809c 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -282,6 +282,11 @@ namespace OpenRCT2::Ui::Windows close(); break; case PathConstructionMode::dragArea: + // If another window has enabled a tool, close ours. + // If the user merely pressed Escape, we cancel the tool but don’t close the window. + if (gInputFlags.has(InputFlag::toolActive) + && gCurrentToolWidget.windowClassification != WindowClass::footpath) + close(); break; case PathConstructionMode::bridgeOrTunnelPick: if (!isToolActive(WindowClass::footpath, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL)) @@ -290,10 +295,6 @@ namespace OpenRCT2::Ui::Windows case PathConstructionMode::bridgeOrTunnel: break; } - - // If another window has enabled a tool, close ours. - if (gInputFlags.has(InputFlag::toolActive) && gCurrentToolWidget.windowClassification != WindowClass::footpath) - close(); } void onMouseDown(WidgetIndex widgetIndex) override @@ -593,7 +594,7 @@ namespace OpenRCT2::Ui::Windows // Draw build this... label screenCoords = this->windowPos + ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 23 }; - DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::centre }); } // Draw cost @@ -605,7 +606,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_windowFootpathCost); - DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::centre }); } } } diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index ca82b080a7..f4cb9623c3 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::FillMode::none); // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); auto& gameState = getGameState(); @@ -115,7 +116,7 @@ namespace OpenRCT2::Ui::Windows StringId stringId = gameState.park.cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; auto ft = Formatter(); ft.Add(gameState.park.cash); - DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre }); } static constexpr StringId _guestCountFormats[] = { @@ -141,7 +142,7 @@ namespace OpenRCT2::Ui::Windows auto colour = GetHoverWidgetColour(WIDX_GUESTS); auto ft = Formatter(); ft.Add(gameState.park.numGuestsInPark); - DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre }); } // Draw park rating @@ -200,10 +201,10 @@ namespace OpenRCT2::Ui::Windows ft.Add(DateDayNames[day]); ft.Add(month); ft.Add(year); - DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre }); // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); // Temperature screenCoords = { windowPos.x + rightPanelWidget.left + 15, static_cast(screenCoords.y + line_height + 1) }; @@ -251,7 +252,7 @@ namespace OpenRCT2::Ui::Windows // Text auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 }; - int32_t itemWidth = middleOutsetWidget.width() - 62; + int32_t itemWidth = middleOutsetWidget.width() - 63; DrawNewsTicker( rt, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->text, newsItem->ticks); @@ -363,11 +364,11 @@ namespace OpenRCT2::Ui::Windows colours[0], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::none); // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); ScreenCoordsXY middleWidgetCoords( windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1); - int32_t panelWidth = middleOutsetWidget->width() - 62; + int32_t panelWidth = middleOutsetWidget->width() - 63; // Check if there is a map tooltip to draw StringId stringId; @@ -377,12 +378,12 @@ namespace OpenRCT2::Ui::Windows { // TODO: this string probably shouldn't be reused for this DrawTextWrapped( - rt, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, { colours[0], TextAlignment::CENTRE }); + rt, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, { colours[0], TextAlignment::centre }); } else { // Show tooltip in bottom toolbar - DrawTextWrapped(rt, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::CENTRE }); + DrawTextWrapped(rt, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::centre }); } } @@ -508,7 +509,7 @@ namespace OpenRCT2::Ui::Windows void onPrepareDraw() override { // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); // Reset dimensions as appropriate -- in case we're switching languages. height = line_height * 2 + 12; @@ -695,7 +696,7 @@ namespace OpenRCT2::Ui::Windows int32_t screenHeight = ContextGetHeight(); // Figure out how much line height we have to work with. - uint32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + uint32_t lineHeight = FontGetLineHeight(FontStyle::medium); int32_t toolbarHeight = lineHeight * 2 + 12; auto* windowMgr = GetWindowManager(); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index fb8dc2fda4..90af298993 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -549,7 +549,7 @@ namespace OpenRCT2::Ui::Windows return; const auto& widget = widgets[WIDX_TAB_1]; - int32_t widgWidth = widget.width() - 1; + int32_t widgWidth = widget.width() - 2; int32_t widgHeight = widget.height() - 1; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; if (page == WINDOW_GUEST_OVERVIEW) @@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr) { const auto& widget = widgets[WIDX_VIEWPORT]; - const auto reqViewportWidth = widget.width() - 1; + const auto reqViewportWidth = widget.width() - 2; const auto reqViewportHeight = widget.height() - 1; viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight) @@ -766,7 +766,7 @@ namespace OpenRCT2::Ui::Windows { const auto& viewWidget = widgets[WIDX_VIEWPORT]; auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y }; - int32_t widgWidth = viewWidget.width() - 1; + int32_t widgWidth = viewWidget.width() - 2; int32_t widgHeight = viewWidget.height() - 1; ViewportCreate(*this, screenPos, widgWidth, widgHeight, focus.value()); @@ -814,13 +814,13 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); peep->FormatActionTo(ft); - int32_t textWidth = actionLabelWidget.width(); - DrawTextEllipsised(rt, screenPos, textWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); + int32_t textWidth = actionLabelWidget.width() - 1; + DrawTextEllipsised(rt, screenPos, textWidth, STR_BLACK_STRING, ft, { TextAlignment::centre }); } // Draw the marquee thought const auto& marqueeWidget = widgets[WIDX_MARQUEE]; - auto marqWidth = marqueeWidget.width() - 3; + auto marqWidth = marqueeWidget.width() - 4; int32_t left = marqueeWidget.left + 2 + windowPos.x; int32_t top = marqueeWidget.top + windowPos.y; int32_t marqHeight = marqueeWidget.height(); @@ -849,11 +849,11 @@ namespace OpenRCT2::Ui::Windows return; } - screenPos.x = marqueeWidget.width() - _marqueePosition; + screenPos.x = marqueeWidget.width() - 1 - _marqueePosition; { auto ft = Formatter(); PeepThoughtSetFormatArgs(&peep->Thoughts[i], ft); - DrawTextBasic(rtMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::Small }); + DrawTextBasic(rtMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::small }); } } @@ -1588,7 +1588,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); PeepThoughtSetFormatArgs(&thought, ft); - screenCoords.y += DrawTextWrapped(rt, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::Small }); + screenCoords.y += DrawTextWrapped(rt, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::small }); // If this is the last visible line end drawing. if (screenCoords.y > windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 32) @@ -1757,7 +1757,7 @@ namespace OpenRCT2::Ui::Windows auto& widget = widgets[WIDX_PAGE_BACKGROUND]; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 4, widget.top + 12 }; - int32_t itemNameWidth = widget.width() - 24; + int32_t itemNameWidth = widget.width() - 25; int32_t maxY = windowPos.y + height - 22; int32_t numItems = 0; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 4b31c17cba..46879a4e35 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -336,7 +336,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, _numPages, widget->width() - 3); + Dropdown::Flag::StayOpen, _numPages, widget->width() - 4); for (size_t i = 0; i < _numPages; i++) { @@ -355,7 +355,7 @@ namespace OpenRCT2::Ui::Windows auto* widget = &widgets[widgetIndex - 1]; WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 2, widget->width() - 3); + Dropdown::Flag::StayOpen, 2, widget->width() - 4); gDropdown.items[static_cast(_selectedView)].setChecked(true); break; @@ -699,7 +699,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); PeepThoughtSetFormatArgs(&thought, ft); - DrawTextEllipsised(rt, { 118, y }, 329, format, ft, { FontStyle::Small }); + DrawTextEllipsised(rt, { 118, y }, 329, format, ft, { FontStyle::small }); break; } break; @@ -744,7 +744,7 @@ namespace OpenRCT2::Ui::Windows // Draw small font if displaying guests if (_selectedView == GuestViewType::Thoughts) { - DrawTextEllipsised(rt, { 0, y }, 414, format, ft, { FontStyle::Small }); + DrawTextEllipsised(rt, { 0, y }, 414, format, ft, { FontStyle::small }); } else { @@ -755,7 +755,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(STR_GUESTS_COUNT_COMMA_SEP); ft.Add(group.NumGuests); - DrawTextBasic(rt, { 326, y }, format, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, { 326, y }, format, ft, { TextAlignment::right }); } y += kSummarisedGuestsRowHeight; index++; diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 78c86b7314..8ee75bf41a 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -178,7 +178,7 @@ namespace OpenRCT2::Ui::Windows { // Scenery not available DrawTextEllipsised( - rt, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + rt, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::centre }); screenPos.y -= kListRowHeight; } } diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 0d08c94711..0e2de599f5 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -268,7 +268,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(gLandToolSize); screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->midY() }; DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } else if (_landToolMountainMode) { @@ -288,7 +288,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_landToolRaiseCost); - DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::centre }); } screenCoords.y += 10; @@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_landToolLowerCost); - DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::centre }); } screenCoords.y += 50; @@ -321,7 +321,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(price); - DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre }); } } } diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 8143e872d4..cfbf37b184 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -405,7 +405,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } // Draw cost amount @@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + offset }; - DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index ee09d4bb3a..2e977c15d9 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -319,7 +320,7 @@ namespace OpenRCT2::Ui::Windows // Check how this date is represented (e.g. 2000-02-20, or 00/02/20) std::string date = Platform::FormatShortDate(long_time); - maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::Medium) + kDateTimeGap; + maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap; // Some locales do not use leading zeros for months and days, so let's try October, too. tm.tm_mon = 10; @@ -328,12 +329,12 @@ namespace OpenRCT2::Ui::Windows // Again, check how this date is represented (e.g. 2000-10-20, or 00/10/20) date = Platform::FormatShortDate(long_time); - maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::Medium) + kDateTimeGap); + maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap); // Time appears to be universally represented with two digits for minutes, so 12:00 or 00:00 should be // representable. std::string time = Platform::FormatTime(long_time); - maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::Medium) + kDateTimeGap; + maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::medium) + kDateTimeGap; } void LoadPreview() @@ -431,7 +432,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_preview.parkName.c_str()); DrawTextEllipsised( rt, namePos, previewPaneSize.width - kPadding * 2, STR_WINDOW_COLOUR_2_STRINGID, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); } const bool drawFrame = image != nullptr || targetType == PreviewImageType::screenshot; @@ -476,7 +477,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic( rt, textPos, previewText, {}, - { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::CENTRE }); + { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre }); return; } @@ -705,7 +706,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Save' button string width auto saveLabel = LanguageGetString(STR_FILEBROWSER_SAVE_BUTTON); - auto saveLabelWidth = GfxGetStringWidth(saveLabel, FontStyle::Medium) + 12; + auto saveLabelWidth = GfxGetStringWidth(saveLabel, FontStyle::medium) + 12; widgets[WIDX_SAVE].type = WidgetType::button; widgets[WIDX_SAVE].top = height - paddingBottom - 15; @@ -715,7 +716,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Filename:' string width auto filenameLabel = LanguageGetString(STR_FILENAME_LABEL); - auto filenameLabelWidth = GfxGetStringWidth(filenameLabel, FontStyle::Medium); + auto filenameLabelWidth = GfxGetStringWidth(filenameLabel, FontStyle::medium); widgets[WIDX_FILENAME_TEXTBOX].type = WidgetType::textBox; widgets[WIDX_FILENAME_TEXTBOX].top = height - paddingBottom - 15; @@ -740,7 +741,7 @@ namespace OpenRCT2::Ui::Windows { const auto& widget = widgets[WIDX_PARENT_FOLDER]; const auto pathWidth = widget.left - 8; - const auto shortPath = ShortenPath(_directory, pathWidth, FontStyle::Medium); + const auto shortPath = ShortenPath(_directory, pathWidth, FontStyle::medium); // Format text std::string buffer; @@ -771,7 +772,7 @@ namespace OpenRCT2::Ui::Windows auto cdpi = const_cast(rt); DrawTextEllipsised( - cdpi, windowPos + ScreenCoordsXY{ widget.left + 5, widget.top + 1 }, widget.width(), strId, ft, + cdpi, windowPos + ScreenCoordsXY{ widget.left + 5, widget.top + 1 }, widget.width() - 1, strId, ft, { COLOUR_GREY }); }; @@ -1081,7 +1082,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); - const int32_t listWidth = widgets[WIDX_SCROLL].width(); + const int32_t listWidth = widgets[WIDX_SCROLL].width() - 1; const auto sizeColumnLeft = widgets[WIDX_SORT_SIZE].left; const auto dateColumnLeft = widgets[WIDX_SORT_DATE].left; const int32_t dateAnchor = dateColumnLeft + maxDateWidth + kDateTimeGap; @@ -1123,7 +1124,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(STR_STRING); ft.Add(_listItems[i].name.c_str()); - int32_t max_file_width = widgets[WIDX_SORT_NAME].width() - 15; + int32_t max_file_width = widgets[WIDX_SORT_NAME].width() - 16; DrawTextEllipsised(rt, { 15, y }, max_file_width, stringId, ft); // Print formatted modified date, if this is a file @@ -1145,7 +1146,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_STRING); ft.Add(_listItems[i].dateFormatted.c_str()); DrawTextEllipsised( - rt, { dateAnchor - kDateTimeGap, y }, maxDateWidth, stringId, ft, { TextAlignment::RIGHT }); + rt, { dateAnchor - kDateTimeGap, y }, maxDateWidth, stringId, ft, { TextAlignment::right }); ft = Formatter(); ft.Add(STR_STRING); diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 3e02d2b62c..880f37b405 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows // Adjust for hidden scrollbars if needed auto& mapArea = widgets[WIDX_MAP]; - if (size.width >= mapArea.width()) + if (size.width >= mapArea.width() - 1) size.width -= kScrollBarWidth; if (size.height >= mapArea.height()) size.height -= kScrollBarWidth; @@ -738,7 +738,7 @@ namespace OpenRCT2::Ui::Windows // calculate width and height of minimap auto& widget = widgets[WIDX_MAP]; - auto mapWidth = widget.width() - kScrollBarWidth - 1; + auto mapWidth = widget.width() - 1 - kScrollBarWidth - 1; auto mapHeight = widget.height() - kScrollBarWidth - 1; centreX = std::max(centreX - (mapWidth >> 1), 0); @@ -1233,7 +1233,7 @@ namespace OpenRCT2::Ui::Windows for (uint32_t i = 0; i < 4; i++) { const auto* labelStr = LanguageGetString(MapLabels[i]); - _firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium), _firstColumnWidth); + _firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium), _firstColumnWidth); } textOffset += _firstColumnWidth + 4; @@ -1242,7 +1242,7 @@ namespace OpenRCT2::Ui::Windows { const auto* labelStr = LanguageGetString(MapLabels[i]); minWidth = std::max( - static_cast(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium)), minWidth); + static_cast(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium)), minWidth); } width = std::max(minWidth, width); _recalculateScrollbars = true; diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 19f2443e19..0b7e191817 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -462,7 +462,7 @@ namespace OpenRCT2::Ui::Windows Widget* ddWidget = &widgets[widgetIndex - 1]; WindowDropdownShowTextCustomWidth( { windowPos.x + ddWidget->left, windowPos.y + ddWidget->top }, ddWidget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, std::size(items), ddWidget->width() - 2); + Dropdown::Flag::StayOpen, std::size(items), ddWidget->width() - 3); gDropdown.items[EnumValue(_settings.algorithm)].setChecked(true); break; diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index 0f5e356e61..2d43802b0c 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -56,7 +56,7 @@ namespace OpenRCT2::Ui::Windows } auto stringCoords = windowPos + ScreenCoordsXY{ width / 2, height / 2 }; - DrawTextWrapped(rt, stringCoords, width, STR_MAP_TOOLTIP_STRINGID, _mapTooltipArgs, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, width, STR_MAP_TOOLTIP_STRINGID, _mapTooltipArgs, { TextAlignment::centre }); } }; diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 17b58364d1..3e849012b2 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -289,7 +290,7 @@ namespace OpenRCT2::Ui::Windows _buffer += Network::GetPlayerName(player); } screenCoords.x = 0; - GfxClipString(_buffer.data(), 230, FontStyle::Medium); + GfxClipString(_buffer.data(), 230, FontStyle::medium); DrawText(rt, screenCoords, { colour }, _buffer.c_str()); // Draw group name @@ -300,7 +301,7 @@ namespace OpenRCT2::Ui::Windows _buffer += "{BLACK}"; screenCoords.x = 173; _buffer += Network::GetGroupName(group); - GfxClipString(_buffer.data(), 80, FontStyle::Medium); + GfxClipString(_buffer.data(), 80, FontStyle::medium); DrawText(rt, screenCoords, { colour }, _buffer.c_str()); } @@ -359,8 +360,8 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(_buffer.c_str()); DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); + rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 9, STR_STRING, ft, + { TextAlignment::centre }); } auto screenPos = windowPos @@ -383,8 +384,8 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(_buffer.c_str()); DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); + rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 9, STR_STRING, ft, + { TextAlignment::centre }); } } @@ -465,7 +466,7 @@ namespace OpenRCT2::Ui::Windows { assert(!_windowInformationSize.has_value()); - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); // Base dimensions. const int32_t baseWidth = 450; @@ -474,7 +475,7 @@ namespace OpenRCT2::Ui::Windows // Server name is displayed word-wrapped, so figure out how high it will be. { int32_t numLines; - GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines); + GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::medium, nullptr, &numLines); baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); } @@ -483,7 +484,7 @@ namespace OpenRCT2::Ui::Windows if (!descString.empty()) { int32_t numLines; - GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines); + GfxWrapString(descString, baseWidth, FontStyle::medium, nullptr, &numLines); baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); } diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 6f3f63ab64..8201902086 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -93,10 +93,10 @@ namespace OpenRCT2::Ui::Windows _buffer.assign("{WHITE}"); _buffer += _windowNetworkStatusText; - GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::Medium); + GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::medium); ScreenCoordsXY screenCoords(windowPos.x + (width / 2), windowPos.y + (height / 2)); - screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::Medium) / 2; + screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::medium) / 2; DrawText(rt, screenCoords, { COLOUR_BLACK }, _buffer.c_str()); } diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 8e8168df88..8d2c640487 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -221,7 +221,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems, - dropdownWidget->width() - 3); + dropdownWidget->width() - 4); } } else @@ -242,7 +242,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems, - dropdownWidget->width() - 3); + dropdownWidget->width() - 4); } break; // In RCT2, the maximum was 6 weeks diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 8f7525c993..60497bb4fa 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -45,11 +45,21 @@ using namespace OpenRCT2::TrackMetaData; namespace OpenRCT2::Ui::Windows { static constexpr StringId WindowTitle = kStringIdNone; - static constexpr ScreenSize kWindowSize = { 601, 382 }; static constexpr int32_t kWindowHeightResearch = 194; static constexpr int32_t RideListItemsMax = 384; static constexpr int32_t RideTabCount = 6; static constexpr int32_t GroupByTrackTypeWidth = 172; + static constexpr int32_t kScrollItemSize = 116; + static constexpr int32_t kMinColCount = 5; + static constexpr int32_t kMaxColCount = 15; + static constexpr int32_t kMinRowCount = 2; + static constexpr int32_t kMaxRowCount = 7; + static constexpr int32_t kHorizontalPadding = 21; + static constexpr int32_t kVerticalPadding = 150; + static constexpr ScreenSize kWindowSize = { (kMinColCount * kScrollItemSize) + kHorizontalPadding, + (kMinRowCount * kScrollItemSize) + kVerticalPadding }; + static constexpr ScreenSize kWindowMaxSize = { (kMaxColCount * kScrollItemSize) + kHorizontalPadding, + (kMaxRowCount * kScrollItemSize) + kVerticalPadding }; #pragma region Ride type view order @@ -415,7 +425,7 @@ namespace OpenRCT2::Ui::Windows const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); auto string = ls.GetString(STR_GROUP_BY_TRACK_TYPE); - auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); + auto strWidth = GfxGetStringWidth(string, FontStyle::medium); auto localizedGroupByTrackTypeWidth = strWidth + 14; widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth; } @@ -447,7 +457,8 @@ namespace OpenRCT2::Ui::Windows count++; listItem++; } - return { widgets[WIDX_RIDE_LIST].width(), ((count + 4) / 5) * 116 }; + auto itemsPerRow = getNumImagesPerRow(); + return { widgets[WIDX_RIDE_LIST].width() - 1, ((count + (itemsPerRow - 1)) / itemsPerRow) * kScrollItemSize }; } void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override @@ -496,8 +507,8 @@ namespace OpenRCT2::Ui::Windows { const auto borderStyle = isSelected ? Rectangle::BorderStyle::inset : Rectangle::BorderStyle::outset; Rectangle::fillInset( - rt, { coords, coords + ScreenCoordsXY{ 115, 115 } }, colours[1], borderStyle, - Rectangle::FillBrightness::dark); + rt, { coords, coords + ScreenCoordsXY{ kScrollItemSize - 1, kScrollItemSize - 1 } }, colours[1], + borderStyle, Rectangle::FillBrightness::dark); } // Draw ride image with feathered border @@ -506,11 +517,11 @@ namespace OpenRCT2::Ui::Windows GfxDrawSpriteRawMasked(rt, coords + ScreenCoordsXY{ 2, 2 }, mask, rideImage); // Next position - coords.x += 116; - if (coords.x >= 116 * 5 + 1) + coords.x += kScrollItemSize; + if (coords.x >= kScrollItemSize * getNumImagesPerRow() + 1) { coords.x = 1; - coords.y += 116; + coords.y += kScrollItemSize; } // Next item @@ -809,8 +820,6 @@ namespace OpenRCT2::Ui::Windows void RefreshWidgetSizing() { - int32_t newWidth{}, newHeight{}; - if (_currentTab < SHOP_TAB) { disabledWidgets &= ~(1 << WIDX_GROUP_BY_TRACK_TYPE); @@ -831,6 +840,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_GROUP_BY_TRACK_TYPE].type = WidgetType::empty; } + ScreenSize newMinSize{}, newMaxSize{}; if (_currentTab != RESEARCH_TAB) { widgets[WIDX_RIDE_LIST].type = WidgetType::scroll; @@ -841,8 +851,8 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WidgetType::empty; widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WidgetType::empty; - newWidth = kWindowSize.width; - newHeight = kWindowSize.height; + newMinSize = kWindowSize; + newMaxSize = kWindowMaxSize; } else { @@ -855,24 +865,35 @@ namespace OpenRCT2::Ui::Windows if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WidgetType::flatBtn; - newWidth = 300; - newHeight = kWindowHeightResearch; + newMinSize = { 300, kWindowHeightResearch }; + newMaxSize = newMinSize; } // Handle new window size - if (width != newWidth || height != newHeight) + if (width != newMinSize.width || height != newMinSize.height) { - ScreenSize newSize = { newWidth, newHeight }; - WindowSetResize(*this, newSize, newSize); + WindowSetResize(*this, newMinSize, newMaxSize); onResize(); - - widgets[WIDX_GROUP_BY_TRACK_TYPE].left = newWidth - 8 - GroupByTrackTypeWidth; - widgets[WIDX_GROUP_BY_TRACK_TYPE].right = newWidth - 8; } initScrollWidgets(); } + void onResize() override + { + widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - GroupByTrackTypeWidth; + widgets[WIDX_GROUP_BY_TRACK_TYPE].right = width - 8; + widgets[WIDX_RIDE_LIST].right = width - 3 - 1; + widgets[WIDX_RIDE_LIST].bottom = height - 65; + } + + uint8_t getNumImagesPerRow() + { + const Widget& listWidget = widgets[WIDX_RIDE_LIST]; + auto scrollWidth = listWidget.width(); + return scrollWidth / kScrollItemSize; + } + RideSelection ScrollGetRideListItemAt(const ScreenCoordsXY& screenCoords) { RideSelection result; @@ -882,12 +903,13 @@ namespace OpenRCT2::Ui::Windows if (screenCoords.x <= 0 || screenCoords.y <= 0) return result; - int32_t column = screenCoords.x / 116; - int32_t row = screenCoords.y / 116; - if (column >= 5) + auto itemsPerRow = getNumImagesPerRow(); + int32_t column = screenCoords.x / kScrollItemSize; + int32_t row = screenCoords.y / kScrollItemSize; + if (column >= itemsPerRow) return result; - int32_t index = column + (row * 5); + int32_t index = column + (row * itemsPerRow); RideSelection* listItem = _windowNewRideListItems; while (listItem->Type != kRideTypeNull || listItem->EntryIndex != kObjectEntryIndexNull) @@ -978,7 +1000,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(price); - DrawTextBasic(rt, screenPos + ScreenCoordsXY{ textWidth, 51 }, stringId, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos + ScreenCoordsXY{ textWidth - 14, 51 }, stringId, ft, { TextAlignment::right }); } // Draw object author(s) if debugging tools are active @@ -1001,7 +1023,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised( rt, screenPos + ScreenCoordsXY{ textWidth, 0 }, kWindowSize.width - 2, STR_WINDOW_COLOUR_2_STRINGID, ft, - { TextAlignment::RIGHT }); + { TextAlignment::right }); } } @@ -1086,7 +1108,8 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::trackDesignPlace); window = windowMgr->Create( - WindowClass::constructRide, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::autoPosition }); + WindowClass::constructRide, kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::autoPosition, WindowFlag::resizable }); return window; } diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 394800e40e..5bf08ec29c 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -113,7 +113,7 @@ namespace OpenRCT2::Ui::Windows static int32_t CalculateNewsItemHeight() { - return 4 * FontGetLineHeight(FontStyle::Small) + 2; + return 4 * FontGetLineHeight(FontStyle::small) + 2; } void initNewsWidgets() @@ -443,7 +443,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - int32_t lineHeight = FontGetLineHeight(FontStyle::Small); + int32_t lineHeight = FontGetLineHeight(FontStyle::small); int32_t itemHeight = CalculateNewsItemHeight(); int32_t y = 0; int32_t i = 0; @@ -476,7 +476,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(DateDayNames[newsItem.day - 1]); ft.Add(DateGameMonthNames[DateGetMonth(newsItem.monthYear)]); - DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small }); + DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::small }); } // Item text { @@ -484,7 +484,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(newsItem.text.c_str()); DrawTextWrapped( rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft, - { COLOUR_BRIGHT_GREEN, FontStyle::Small }); + { COLOUR_BRIGHT_GREEN, FontStyle::small }); } // Subject button if ((newsItem.typeHasSubject()) && !(newsItem.hasButton())) diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index aa9d04ec0f..dd6372b294 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -516,7 +516,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); - const int32_t listWidth = widgets[WIDX_SCROLL].width(); + const int32_t listWidth = widgets[WIDX_SCROLL].width() - 1; for (int32_t i = 0; i < numListItems; i++) { diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 471e03e2b0..607a5b0c99 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -1803,7 +1803,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, numItems, widget->width() - 3); + Dropdown::Flag::StayOpen, numItems, widget->width() - 4); gDropdown.items[static_cast(ThemeManagerGetAvailableThemeIndex())].setChecked(true); invalidateWidget(WIDX_THEMES_DROPDOWN); @@ -1934,7 +1934,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, numItems, widget->width() - 3); + Dropdown::Flag::StayOpen, numItems, widget->width() - 4); gDropdown.items[Config::Get().interface.scenarioPreviewScreenshots].setChecked(true); break; @@ -2187,7 +2187,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Clear' button string width auto clearLabel = LanguageGetString(STR_CLEAR_BUTTON); - auto clearLabelWidth = GfxGetStringWidth(clearLabel, FontStyle::Medium) + 12; + auto clearLabelWidth = GfxGetStringWidth(clearLabel, FontStyle::medium) + 12; widgets[WIDX_PATH_TO_RCT1_CLEAR].right = widgets[WIDX_PAGE_BACKGROUND].right - 12; widgets[WIDX_PATH_TO_RCT1_CLEAR].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - clearLabelWidth; @@ -2200,7 +2200,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Browse' button string width auto browseLabel = LanguageGetString(STR_BROWSE); - auto browseLabelWidth = GfxGetStringWidth(browseLabel, FontStyle::Medium) + 12; + auto browseLabelWidth = GfxGetStringWidth(browseLabel, FontStyle::medium) + 12; widgets[WIDX_PATH_TO_RCT1_BROWSE].right = widgets[WIDX_PAGE_BACKGROUND].right - 12; widgets[WIDX_PATH_TO_RCT1_BROWSE].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - browseLabelWidth; @@ -2241,11 +2241,11 @@ namespace OpenRCT2::Ui::Windows int32_t widgetHeight = pathWidget.bottom - pathWidget.top; // Apply vertical alignment if font height requires it - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); int32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0; auto screenCoords = windowPos + ScreenCoordsXY{ pathWidget.left + 1, pathWidget.top + padding }; - DrawTextEllipsised(rt, screenCoords, pathWidget.width(), STR_BLACK_STRING, ft); + DrawTextEllipsised(rt, screenCoords, pathWidget.width() - 1, STR_BLACK_STRING, ft); } OpenRCT2String AdvancedTooltip(WidgetIndex widgetIndex, StringId fallback) @@ -2297,7 +2297,7 @@ namespace OpenRCT2::Ui::Windows // helper function, all dropdown boxes have similar properties WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, num_items, widget->width() - 3); + Dropdown::Flag::StayOpen, num_items, widget->width() - 4); } void DrawTabImages(RenderTarget& rt) @@ -2352,7 +2352,7 @@ namespace OpenRCT2::Ui::Windows uint8_t GetScrollPercentage(const Widget& widget, const ScrollArea& scroll) { - uint8_t w = widget.width() - 1; + uint8_t w = widget.width() - 2; return static_cast(scroll.contentOffsetX) / (scroll.contentWidth - w) * 100; } @@ -2361,7 +2361,7 @@ namespace OpenRCT2::Ui::Windows const auto& widget = widgets[widgetIndex]; auto& scroll = scrolls[scrollId]; - int32_t widgetSize = scroll.contentWidth - (widget.width() - 1); + int32_t widgetSize = scroll.contentWidth - (widget.width() - 2); scroll.contentOffsetX = ceil(volume / 100.0f * widgetSize); widgetScrollUpdateThumbs(*this, widgetIndex); diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp index 684ae34c24..30f41c9cec 100644 --- a/src/openrct2-ui/windows/OverwritePrompt.cpp +++ b/src/openrct2-ui/windows/OverwritePrompt.cpp @@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_name.c_str()); ScreenCoordsXY stringCoords(windowPos.x + width / 2, windowPos.y + (height / 2) - 3); - DrawTextWrapped(rt, stringCoords, width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, ft, { TextAlignment::centre }); } }; diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index b7538e7dd8..eecb8c5e38 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -604,8 +604,8 @@ namespace OpenRCT2::Ui::Windows auto* labelWidget = &widgets[WIDX_STATUS]; DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ labelWidget->midX(), labelWidget->top }, labelWidget->width(), STR_BLACK_STRING, - ft, { TextAlignment::CENTRE }); + rt, windowPos + ScreenCoordsXY{ labelWidget->midX(), labelWidget->top }, labelWidget->width() - 1, + STR_BLACK_STRING, ft, { TextAlignment::centre }); } void initViewport() @@ -646,7 +646,7 @@ namespace OpenRCT2::Ui::Windows Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; ViewportCreate( *this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, - viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value()); + viewportWidget->width() - 2, viewportWidget->height() - 1, focus.value()); flags |= WindowFlag::noScrolling; invalidate(); } @@ -692,7 +692,7 @@ namespace OpenRCT2::Ui::Windows char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{COMMA32}", _ratingProps.max); - int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1; + int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1; const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y }; _ratingProps.RecalculateLayout( @@ -773,7 +773,7 @@ namespace OpenRCT2::Ui::Windows char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{COMMA32}", _guestProps.max); - int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1; + int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1; const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y }; _guestProps.RecalculateLayout( diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index c27ca7d179..dab5a095d4 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -148,7 +148,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index a1fe1a599e..f450d6e0da 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -390,7 +390,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_VIEWPORT].right = width - 26; widgets[WIDX_VIEWPORT].bottom = height - 14; - int32_t groupDropdownWidth = widgets[WIDX_GROUP].width(); + int32_t groupDropdownWidth = widgets[WIDX_GROUP].width() - 1; widgets[WIDX_GROUP].left = (width - groupDropdownWidth) / 2; widgets[WIDX_GROUP].right = widgets[WIDX_GROUP].left + groupDropdownWidth; widgets[WIDX_GROUP_DROPDOWN].left = widgets[WIDX_GROUP].right - 10; @@ -403,7 +403,7 @@ namespace OpenRCT2::Ui::Windows Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left, viewportWidget->top }; - viewport->width = viewportWidget->width(); + viewport->width = viewportWidget->width() - 1; viewport->height = viewportWidget->height(); } @@ -439,8 +439,8 @@ namespace OpenRCT2::Ui::Windows ft.Add(_buffer.c_str()); DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); + rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 9, STR_STRING, ft, + { TextAlignment::centre }); } // Draw ping @@ -466,7 +466,7 @@ namespace OpenRCT2::Ui::Windows { ft.Add(STR_ACTION_NA); } - DrawTextEllipsised(rt, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::centre }); if (viewport != nullptr && _drawViewport) { diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 3965e914e2..56f9eb7540 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_demolishRideCost / 2); ScreenCoordsXY stringCoords(windowPos.x + kWindowSize.width / 2, windowPos.y + (kWindowSize.height / 2) - 3); - DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::centre }); } } }; diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 4fd933ffe6..8f7a8e8605 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -483,7 +483,7 @@ namespace OpenRCT2::Ui::Windows } WindowDropdownShowTextCustomWidth( { w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 3); + w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 4); int32_t currentResearchLevel = gameState.researchFundingLevel; gDropdown.items[currentResearchLevel].setChecked(true); diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 877dd5d086..3794ef7865 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -624,7 +625,7 @@ namespace OpenRCT2::Ui::Windows { ride_type_t RideTypeId; StringId LabelId; - u8string_view LabelString; + u8string LabelString; }; // Used for sorting the vehicle type dropdown. @@ -1582,7 +1583,7 @@ namespace OpenRCT2::Ui::Windows const auto& viewWidget = widgets[WIDX_VIEWPORT]; auto screenPos = windowPos + ScreenCoordsXY{ viewWidget.left + 1, viewWidget.top + 1 }; - int32_t viewWidth = viewWidget.width() - 1; + int32_t viewWidth = viewWidget.width() - 2; int32_t viewHeight = viewWidget.height() - 1; ViewportCreate(*this, screenPos, viewWidth, viewHeight, focus.value()); @@ -1877,29 +1878,12 @@ namespace OpenRCT2::Ui::Windows static constexpr StringId GetRideTypeNameForDropdown(ride_type_t rideType) { - switch (rideType) + auto stringId = GetRideTypeDescriptor(rideType).Naming.Name; + if (stringId == STR_UNKNOWN_RIDE) { - case RIDE_TYPE_1D: - return STR_RIDE_NAME_1D; - case RIDE_TYPE_1F: - return STR_RIDE_NAME_1F; - case RIDE_TYPE_22: - return STR_RIDE_NAME_22; - case RIDE_TYPE_50: - return STR_RIDE_NAME_50; - case RIDE_TYPE_52: - return STR_RIDE_NAME_52; - case RIDE_TYPE_53: - return STR_RIDE_NAME_53; - case RIDE_TYPE_54: - return STR_RIDE_NAME_54; - case RIDE_TYPE_55: - return STR_RIDE_NAME_55; - case RIDE_TYPE_59: - return STR_RIDE_NAME_59; - default: - return GetRideTypeDescriptor(rideType).Naming.Name; + stringId = STR_RIDE_NAME_UNKNOWN_INT32; } + return stringId; } void PopulateRideTypeDropdown() @@ -1912,8 +1896,13 @@ namespace OpenRCT2::Ui::Windows for (uint8_t i = 0; i < RIDE_TYPE_COUNT; i++) { + // Will return the actual name for most rides, but a special string "Unknown Ride ({INT32})" for unknown ones. + // The placeholder will then be filled with the ID. auto name = GetRideTypeNameForDropdown(i); - _rideDropdownData.push_back({ i, name, u8string_view{ ls.GetString(name) } }); + auto ft = Formatter(); + ft.Add(i); + auto label = FormatStringIDLegacy(name, ft.Data()); + _rideDropdownData.push_back({ i, name, label }); } std::sort(_rideDropdownData.begin(), _rideDropdownData.end(), [](auto& a, auto& b) { @@ -1933,7 +1922,7 @@ namespace OpenRCT2::Ui::Windows for (size_t i = 0; i < _rideDropdownData.size(); i++) { - gDropdown.items[i] = Dropdown::MenuLabel(_rideDropdownData[i].LabelId); + gDropdown.items[i] = Dropdown::MenuLabel(_rideDropdownData[i].LabelString); } Widget* dropdownWidget = widget - 1; @@ -2086,7 +2075,7 @@ namespace OpenRCT2::Ui::Windows Widget* dropdownWidget = widget - 1; WindowDropdownShowTextCustomWidth( { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1, - colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width()); + colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 1); // Find the current vehicle type in the ordered list. int32_t pos = 0; @@ -2609,15 +2598,15 @@ namespace OpenRCT2::Ui::Windows auto* widget = &widgets[WIDX_VIEW]; DrawTextBasic( rt, { windowPos.x + (widget->left + widget->right - 11) / 2, windowPos.y + widget->top }, - STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::centre }); // Status ft = Formatter(); widget = &widgets[WIDX_STATUS]; StringId rideStatus = GetStatus(ft); DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width(), rideStatus, - ft, { TextAlignment::CENTRE }); + rt, windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width() - 1, + rideStatus, ft, { TextAlignment::centre }); } #pragma endregion @@ -2875,7 +2864,7 @@ namespace OpenRCT2::Ui::Windows // Description auto ft = Formatter(); ft.Add(rideEntry->naming.Description); - screenCoords.y += DrawTextWrapped(rt, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::LEFT }); + screenCoords.y += DrawTextWrapped(rt, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::left }); screenCoords.y += 2; // Capacity @@ -2898,7 +2887,7 @@ namespace OpenRCT2::Ui::Windows // Intensity Factor if (rideEntry->intensity_multiplier != 0) { - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); if (lineHeight != 10) screenCoords.x += 150; else @@ -2957,7 +2946,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width, rt.y + rt.height } }, PaletteIndex::pi12); Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW]; - int32_t startX = std::max(2, (widget->width() - ((ride->numTrains - 1) * 36)) / 2 - 25); + int32_t startX = std::max(2, (widget->width() - 1 - ((ride->numTrains - 1) * 36)) / 2 - 25); int32_t startY = widget->height() - 4; bool isReversed = ride->hasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS); @@ -4120,7 +4109,7 @@ namespace OpenRCT2::Ui::Windows { if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE) { - DrawTextWrapped(rt, screenCoords, 280, stringId, {}, { TextAlignment::LEFT }); + DrawTextWrapped(rt, screenCoords, 280, stringId, {}, { TextAlignment::left }); } else { @@ -4129,7 +4118,7 @@ namespace OpenRCT2::Ui::Windows { ft = Formatter(); staff->FormatNameTo(ft); - DrawTextWrapped(rt, screenCoords, 280, stringId, ft, { TextAlignment::LEFT }); + DrawTextWrapped(rt, screenCoords, 280, stringId, ft, { TextAlignment::left }); } } } @@ -4890,7 +4879,7 @@ namespace OpenRCT2::Ui::Windows if (ClipDrawPixelInfo( clippedDpi, rt, windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 }, - entrancePreviewWidget.width(), entrancePreviewWidget.height())) + entrancePreviewWidget.width() - 1, entrancePreviewWidget.height())) { GfxClear(clippedDpi, PaletteIndex::pi12); @@ -5137,7 +5126,7 @@ namespace OpenRCT2::Ui::Windows // Figure out minimum size ScreenSize size{}; size.height = widgets[WIDX_MUSIC_DATA].height() - 2; - size.width = widgets[WIDX_MUSIC_DATA].width() - 2; + size.width = widgets[WIDX_MUSIC_DATA].width() - 3; auto ride = GetRide(rideId); if (ride == nullptr) @@ -5155,8 +5144,8 @@ namespace OpenRCT2::Ui::Windows if (track->Name.empty()) continue; - auto nameWidth = GfxGetStringWidth(track->Name.c_str(), FontStyle::Small); - auto composerWidth = GfxGetStringWidth(track->Composer.c_str(), FontStyle::Small); + auto nameWidth = GfxGetStringWidth(track->Name.c_str(), FontStyle::small); + auto composerWidth = GfxGetStringWidth(track->Composer.c_str(), FontStyle::small); newWidth = std::max(newWidth, nameWidth + composerWidth + 24); } @@ -5241,7 +5230,7 @@ namespace OpenRCT2::Ui::Windows // 'Tracks' caption auto trackLabelPos = windowPos + ScreenCoordsXY{ widgets[WIDX_MUSIC_DATA].left, widgets[WIDX_MUSIC_DATA].top - 13 }; - DrawTextWrapped(rt, trackLabelPos, width, STR_MUSIC_OBJECT_TRACK_HEADER, {}, { TextAlignment::LEFT }); + DrawTextWrapped(rt, trackLabelPos, width, STR_MUSIC_OBJECT_TRACK_HEADER, {}, { TextAlignment::left }); // Do we have a preview image to draw? auto musicObj = ride->getMusicObject(); @@ -5251,7 +5240,7 @@ namespace OpenRCT2::Ui::Windows // Figure out where the image should go const auto& previewWidget = widgets[WIDX_MUSIC_IMAGE]; - int32_t clipWidth = previewWidget.width() - 1; + int32_t clipWidth = previewWidget.width() - 2; int32_t clipHeight = previewWidget.height() - 1; // Draw the preview image @@ -5307,7 +5296,7 @@ namespace OpenRCT2::Ui::Windows : STR_MUSIC_OBJECT_TRACK_LIST_ITEM_WITH_COMPOSER; // Draw the track - DrawTextBasic(rt, { 0, y }, stringId, ft, { FontStyle::Small }); + DrawTextBasic(rt, { 0, y }, stringId, ft, { FontStyle::small }); y += kScrollableRowHeight; } } @@ -5614,9 +5603,9 @@ namespace OpenRCT2::Ui::Windows { Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; - ScreenCoordsXY widgetCoords(windowPos.x + widget->width() / 2, windowPos.y + widget->top + 40); + ScreenCoordsXY widgetCoords(windowPos.x + widget->midX(), windowPos.y + widget->top + 40); DrawTextWrapped( - rt, widgetCoords, width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::CENTRE }); + rt, widgetCoords, width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::centre }); widgetCoords.x = windowPos.x + 4; widgetCoords.y = windowPos.y + widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17; @@ -5937,11 +5926,11 @@ namespace OpenRCT2::Ui::Windows { RideMeasurement* measurement{}; std::tie(measurement, std::ignore) = ride->getMeasurement(); - x = measurement == nullptr ? 0 : measurement->current_item - ((widget->width() / 4) * 3); + x = measurement == nullptr ? 0 : measurement->current_item - (((widget->width() - 1) / 4) * 3); } } - scrolls[0].contentOffsetX = std::clamp(x, 0, scrolls[0].contentWidth - (widget->width() - 2)); + scrolls[0].contentOffsetX = std::clamp(x, 0, scrolls[0].contentWidth - (widget->width() - 3)); widgetScrollUpdateThumbs(*this, WIDX_GRAPH); } @@ -5951,7 +5940,7 @@ namespace OpenRCT2::Ui::Windows ScreenSize size{}; // Set minimum size - size.width = widgets[WIDX_GRAPH].width() - 2; + size.width = widgets[WIDX_GRAPH].width() - 3; // Get measurement size auto ride = GetRide(rideId); @@ -6072,8 +6061,8 @@ namespace OpenRCT2::Ui::Windows { // No measurement message ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5); - int32_t txtWidth = widget->width() - 2; - DrawTextWrapped(rt, stringCoords, txtWidth, message.str, message.args, { TextAlignment::CENTRE }); + int32_t txtWidth = widget->width() - 3; + DrawTextWrapped(rt, stringCoords, txtWidth, message.str, message.args, { TextAlignment::centre }); return; } @@ -6124,7 +6113,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(scaled_yUnit); - DrawTextBasic(rt, { scrolls[0].contentOffsetX + 1, y - 4 }, stringID, ft, { FontStyle::Small }); + DrawTextBasic(rt, { scrolls[0].contentOffsetX + 1, y - 4 }, stringID, ft, { FontStyle::small }); } // Time marks @@ -6134,7 +6123,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(time); if (x + 80 >= rt.x) - DrawTextBasic(rt, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::Small }); + DrawTextBasic(rt, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::small }); time += 5; } @@ -6879,7 +6868,7 @@ namespace OpenRCT2::Ui::Windows stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES; ft = Formatter(); ft.Add(queueTime); - screenCoords.y += DrawTextWrapped(rt, screenCoords, 308, stringId, ft, { TextAlignment::LEFT }); + screenCoords.y += DrawTextWrapped(rt, screenCoords, 308, stringId, ft, { TextAlignment::left }); screenCoords.y += 5; } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index f9a4d9e45b..99bf94f422 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -1705,7 +1705,7 @@ namespace OpenRCT2::Ui::Windows // Draw track piece auto screenCoords = ScreenCoordsXY{ windowPos.x + widget->left + 1, windowPos.y + widget->top + 1 }; - widgetWidth = widget->width() - 1; + widgetWidth = widget->width() - 2; widgetHeight = widget->height() - 1; if (ClipDrawPixelInfo(clippedRT, rt, screenCoords, widgetWidth, widgetHeight)) { @@ -1716,14 +1716,14 @@ namespace OpenRCT2::Ui::Windows // Draw cost screenCoords = { windowPos.x + widget->midX(), windowPos.y + widget->bottom - 23 }; if (_rideConstructionState != RideConstructionState::Place) - DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::centre }); screenCoords.y += 11; if (_currentTrackPrice != kMoney64Undefined && !(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_currentTrackPrice); - DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::centre }); } } @@ -2626,7 +2626,7 @@ namespace OpenRCT2::Ui::Windows } // Tune dropdown to the elements it contains - auto ddWidth = widget->width(); + auto ddWidth = widget->width() - 1; auto targetColumnSize = _specialElementDropdownState.PreferredNumRows; if (targetColumnSize < _specialElementDropdownState.Elements.size()) ddWidth -= 30; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 8f1e4655f3..bd574be37c 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -343,7 +343,7 @@ namespace OpenRCT2::Ui::Windows const auto& headerWidget = widgets[WIDX_HEADER_OTHER]; const auto& customWidget = widgets[WIDX_HEADER_CUSTOMISE]; - auto totalWidth = headerWidget.width() + customWidget.width(); + auto totalWidth = headerWidget.width() - 1 + customWidget.width() - 1; WindowDropdownShowTextCustomWidth( { windowPos.x + headerWidget.left, windowPos.y + headerWidget.top }, headerWidget.height(), colours[1], 0, @@ -526,7 +526,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_HEADER_CUSTOMISE].right = widgets[WIDX_LIST].right - 1; widgets[WIDX_HEADER_CUSTOMISE].left = widgets[WIDX_HEADER_CUSTOMISE].right - 14; - auto columnWidth = (widgets[WIDX_LIST].width() - widgets[WIDX_HEADER_CUSTOMISE].width()) / 2; + auto columnWidth = (widgets[WIDX_LIST].width() - 1 - widgets[WIDX_HEADER_CUSTOMISE].width() - 1) / 2; widgets[WIDX_HEADER_OTHER].right = widgets[WIDX_HEADER_CUSTOMISE].left - 1; widgets[WIDX_HEADER_OTHER].left = widgets[WIDX_HEADER_OTHER].right - columnWidth + 1; @@ -603,7 +603,7 @@ namespace OpenRCT2::Ui::Windows auto cdpi = const_cast(rt); DrawTextEllipsised( - cdpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }, widget.width(), + cdpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }, widget.width() - 1, STR_RIDE_LIST_HEADER_FORMAT, ft, { colours[1] }); }; @@ -659,7 +659,7 @@ namespace OpenRCT2::Ui::Windows ridePtr->formatNameTo(ft); auto& nameHeader = widgets[WIDX_HEADER_NAME]; - DrawTextEllipsised(rt, { 0, y - 1 }, nameHeader.width() - 2, format, ft); + DrawTextEllipsised(rt, { 0, y - 1 }, nameHeader.width() - 3, format, ft); // Ride information ft = Formatter(); @@ -866,7 +866,7 @@ namespace OpenRCT2::Ui::Windows } auto infoHeader = widgets[WIDX_HEADER_OTHER]; - DrawTextEllipsised(rt, { infoHeader.left - 4, y - 1 }, infoHeader.width() - 2, format, ft); + DrawTextEllipsised(rt, { infoHeader.left - 4, y - 1 }, infoHeader.width() - 3, format, ft); y += kScrollableRowHeight; } } diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index bfecda1e51..750463c69f 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -245,7 +246,7 @@ namespace OpenRCT2::Ui::Windows return; auto& objManager = GetContext()->GetObjectManager(); - if (auto obj = objManager.LoadTempObject(source.textObjectId); obj != nullptr) + if (auto obj = objManager.LoadTempObject(source.textObjectId, true); obj != nullptr) { auto& scenarioMetaObj = reinterpret_cast(*obj); scenarioMetaObj.Load(); @@ -306,12 +307,12 @@ namespace OpenRCT2::Ui::Windows drawWidgets(rt); StringId format = STR_WINDOW_COLOUR_2_STRINGID; - FontStyle fontStyle = FontStyle::Medium; + FontStyle fontStyle = FontStyle::medium; if (ScenarioSelectUseSmallFont()) { format = STR_SMALL_WINDOW_COLOUR_2_STRINGID; - fontStyle = FontStyle::Small; + fontStyle = FontStyle::small; } // Text for each tab @@ -325,7 +326,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(kScenarioOriginStringIds[i]); auto stringCoords = windowPos + ScreenCoordsXY{ widget.midX(), widget.midY() - 3 }; - DrawTextWrapped(rt, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontStyle, TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontStyle, TextAlignment::centre }); } auto previewPaneWidth = GetPreviewPaneWidth(); @@ -341,7 +342,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; DrawTextEllipsised( rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 0 }, previewPaneWidth, STR_SCENARIO_LOCKED, {}, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); DrawTextWrapped(rt, screenPos + ScreenCoordsXY{ 0, 15 }, previewPaneWidth, STR_SCENARIO_LOCKED_DESC); } @@ -359,7 +360,7 @@ namespace OpenRCT2::Ui::Windows // Scenario path if (Config::Get().general.debuggingTools) { - const auto shortPath = ShortenPath(scenario->Path, width - 6 - kTabWidth, FontStyle::Medium); + const auto shortPath = ShortenPath(scenario->Path, width - 6 - kTabWidth, FontStyle::medium); auto ft = Formatter(); ft.Add(shortPath.c_str()); @@ -374,7 +375,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(scenario->Name.c_str()); DrawTextEllipsised( rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 0 }, previewPaneWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); // Still loading the preview? if (_previewLoadJob.isValid()) @@ -383,7 +384,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_LOADING_GENERIC); DrawTextBasic( rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 15 }, STR_BLACK_STRING, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); return; } @@ -553,12 +554,12 @@ namespace OpenRCT2::Ui::Windows } const auto& listWidget = widgets[WIDX_SCENARIOLIST]; - int32_t listWidth = listWidget.width() - 12; + int32_t listWidth = listWidget.width() - 13; const int32_t scenarioItemHeight = GetScenarioListItemSize(); // Scenario title - int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::Medium); + int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::medium); int32_t y = 0; for (const auto& listItem : _listItems) @@ -599,18 +600,18 @@ namespace OpenRCT2::Ui::Windows ft.Add(scenario->Name.c_str()); auto colour = isDisabled ? colours[1].withFlag(ColourFlag::inset, true) : ColourWithFlags{ COLOUR_BLACK }; - auto darkness = isDisabled ? TextDarkness::Dark : TextDarkness::Regular; + auto darkness = isDisabled ? TextDarkness::dark : TextDarkness::regular; const auto scrollCentre = widgets[WIDX_SCENARIOLIST].width() / 2; DrawTextBasic( rt, { scrollCentre, y + 1 }, format, ft, - { colour, FontStyle::Medium, TextAlignment::CENTRE, darkness }); + { colour, FontStyle::medium, TextAlignment::centre, darkness }); // Check if scenario is completed if (isCompleted) { // Draw completion tick - GfxDrawSprite(rt, ImageId(SPR_MENU_CHECKMARK), { widgets[WIDX_SCENARIOLIST].width() - 45, y + 1 }); + GfxDrawSprite(rt, ImageId(SPR_MENU_CHECKMARK), { widgets[WIDX_SCENARIOLIST].width() - 46, y + 1 }); // Draw completion score u8string completedByName = "???"; @@ -624,7 +625,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(completedByName.c_str()); DrawTextBasic( rt, { scrollCentre, y + scenarioTitleHeight + 1 }, format, ft, - { FontStyle::Small, TextAlignment::CENTRE }); + { FontStyle::small, TextAlignment::centre }); } y += scenarioItemHeight; @@ -643,13 +644,13 @@ namespace OpenRCT2::Ui::Windows // Draw string int32_t centreX = (left + right) / 2; - DrawTextBasic(rt, { centreX, y }, stringId, {}, { baseColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { centreX, y }, stringId, {}, { baseColour, TextAlignment::centre }); // Get string dimensions utf8 buffer[512]; auto bufferPtr = buffer; OpenRCT2::FormatStringLegacy(bufferPtr, sizeof(buffer), stringId, nullptr); - int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::Medium) / 2) + 4; + int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::medium) / 2) + 4; int32_t strLeft = centreX - categoryStringHalfWidth; int32_t strRight = centreX + categoryStringHalfWidth; @@ -848,10 +849,10 @@ namespace OpenRCT2::Ui::Windows return kTrueFontSize; // Scenario title - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); // 'Completed by' line - lineHeight += FontGetLineHeight(FontStyle::Small); + lineHeight += FontGetLineHeight(FontStyle::small); return lineHeight; } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index d6da13d082..c3d3892c06 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -206,6 +207,12 @@ namespace OpenRCT2::Ui::Windows } }; + struct ProvisionalWallTile + { + CoordsXYZD location; + int32_t calculatedZ; + }; + std::vector _tabEntries; int32_t _requiredWidth; int32_t _actualMinHeight; @@ -216,6 +223,18 @@ namespace OpenRCT2::Ui::Windows uint8_t _unkF64F0E{ 0 }; int16_t _unkF64F0A{ 0 }; + CoordsXY _dragStartPos{}; + /** + * When placing fences in the air using Shift, the user may shift their mouse to the left or right. + * We save this position to avoid detecting a wall drag where there isn’t one. + */ + CoordsXY _dragStartHoverPos{}; + CoordsXY _dragEndPos{}; + uint8_t _startEdge{}; + GameActions::Result _lastProvisionalError{}; + bool _inDragMode = false; + std::vector _provisionalTiles{}; + public: void onOpen() override { @@ -255,6 +274,7 @@ namespace OpenRCT2::Ui::Windows void onClose() override { SceneryRemoveGhostToolPlacement(); + removeProvisionalTilesFromMap(); HideGridlines(); ViewportSetVisibility(ViewportVisibility::standard); @@ -849,7 +869,7 @@ namespace OpenRCT2::Ui::Windows // -14 DrawTextBasic( - rt, windowPos + ScreenCoordsXY{ width - 0x1A, height - 13 }, STR_COST_LABEL, ft, { TextAlignment::RIGHT }); + rt, windowPos + ScreenCoordsXY{ width - 0x1A, height - 13 }, STR_COST_LABEL, ft, { TextAlignment::right }); } auto ft = Formatter(); @@ -1058,7 +1078,7 @@ namespace OpenRCT2::Ui::Windows int32_t GetNumColumns() const { const auto& listWidget = widgets[WIDX_SCENERY_LIST]; - const auto contentWidth = listWidget.width() - kScrollBarWidth; + const auto contentWidth = listWidget.width() - 1 - kScrollBarWidth; return contentWidth / kSceneryButtonWidth; } @@ -1814,6 +1834,13 @@ namespace OpenRCT2::Ui::Windows void onToolUpdateWall(WidgetIndex widgetIndex, const ScreenCoordsXY& screenPos, ScenerySelection selection) { + bool isLeftMousePressed = gInputFlags.has(InputFlag::leftMousePressed); + if (isLeftMousePressed) + { + gMapSelectFlags.set(MapSelectFlag::enable); + return; + } + CoordsXY mapTile = {}; uint8_t edge; @@ -1826,10 +1853,7 @@ namespace OpenRCT2::Ui::Windows } gMapSelectFlags.set(MapSelectFlag::enable); - gMapSelectPositionA.x = mapTile.x; - gMapSelectPositionA.y = mapTile.y; - gMapSelectPositionB.x = mapTile.x; - gMapSelectPositionB.y = mapTile.y; + setMapSelectRange(mapTile); gMapSelectType = getMapSelectEdge(edge); MapInvalidateSelectionRect(); @@ -2717,6 +2741,8 @@ namespace OpenRCT2::Ui::Windows if (gridPos.IsNull()) return; + gridPos = gridPos.ToTileStart(); + if (Config::Get().general.virtualFloorStyle != VirtualFloorStyles::Off) { VirtualFloorSetHeight(gSceneryPlaceZ); @@ -3027,6 +3053,31 @@ namespace OpenRCT2::Ui::Windows auto res = GameActions::Execute(&footpathAdditionPlaceAction, gameState); } + std::optional getMapPosFromScreenPos(const ScreenCoordsXY& screenCoords) + { + CoordsXY coords; + if (gSceneryPlaceZ > 0) + { + auto candidate = ScreenGetMapXYWithZ(screenCoords, gSceneryPlaceZ); + if (!candidate.has_value()) + return std::nullopt; + + coords = *candidate; + } + else + { + auto info = GetMapCoordinatesFromPos(screenCoords, EnumsToFlags(ViewportInteractionItem::terrain)); + + if (info.interactionType == ViewportInteractionItem::none) + return std::nullopt; + + coords = info.Loc; + } + + coords = coords.ToTileStart(); + return coords; + } + void onToolDownWall(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords, uint16_t selectedScenery) { CoordsXY gridPos; @@ -3068,19 +3119,165 @@ namespace OpenRCT2::Ui::Windows } } - auto wallPlaceAction = GameActions::WallPlaceAction( - selectedScenery, { gridPos, gSceneryPlaceZ }, edges, _sceneryPrimaryColour, _scenerySecondaryColour, - _sceneryTertiaryColour); + _inDragMode = true; + _dragStartPos = gridPos; + auto hoverPos = getMapPosFromScreenPos(screenCoords); + _dragStartHoverPos = hoverPos.has_value() ? *hoverPos : gridPos; + _dragEndPos = {}; + _startEdge = edges; + gMapSelectFlags.set(MapSelectFlag::enable); + gMapSelectType = getMapSelectEdge(_startEdge); + setMapSelectRange(gridPos); + } - wallPlaceAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) { - if (result->Error == GameActions::Status::Ok) - { - Audio::Play3D(Audio::SoundId::placeItem, result->Position); - } - }); + void dragWallSetEndPos(const ScreenCoordsXY& screenCoords) + { + auto endCoords = getMapPosFromScreenPos(screenCoords); + if (!endCoords.has_value()) + return; + if (endCoords == _dragStartHoverPos) + { + endCoords = _dragStartPos; + } + + const bool onXAxis = (_startEdge == 1 || _startEdge == 3); + if (onXAxis) + { + endCoords->y = _dragStartPos.y; + } + else + { + endCoords->x = _dragStartPos.x; + } + + if (*endCoords != _dragEndPos) + { + setMapSelectRange({ _dragStartPos, *endCoords }); + updateProvisionalTiles(); + } + _dragEndPos = *endCoords; + } + + void removeProvisionalTilesFromMap() + { auto& gameState = getGameState(); - auto res = GameActions::Execute(&wallPlaceAction, gameState); + for (const auto& tile : _provisionalTiles) + { + auto location = tile.location; + location.z = tile.calculatedZ; + auto wallRemoveAction = GameActions::WallRemoveAction(location); + wallRemoveAction.SetFlags( + GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + wallRemoveAction.Execute(gameState); + } + } + + void updateProvisionalTiles() + { + auto& gameState = getGameState(); + auto tabSelection = WindowSceneryGetTabSelection(); + removeProvisionalTilesFromMap(); + + _provisionalTiles.clear(); + _lastProvisionalError = {}; + + auto mapRange = getMapSelectRange(); + for (auto y = mapRange.GetY1(); y <= mapRange.GetY2(); y += kCoordsXYStep) + { + for (auto x = mapRange.GetX1(); x <= mapRange.GetX2(); x += kCoordsXYStep) + { + auto wallPlaceAction = GameActions::WallPlaceAction( + tabSelection.EntryIndex, { x, y, gSceneryPlaceZ }, _startEdge, _sceneryPrimaryColour, + _scenerySecondaryColour, _sceneryTertiaryColour); + wallPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); + + auto result = GameActions::Execute(&wallPlaceAction, gameState); + if (result.Error == GameActions::Status::Ok) + { + const auto placementData = result.GetData(); + _provisionalTiles.push_back({ CoordsXYZD(x, y, gSceneryPlaceZ, _startEdge), placementData.BaseHeight }); + } + else + { + _lastProvisionalError = result; + } + } + } + } + + void onToolDragWall(const ScreenCoordsXY& screenCoords) + { + if (!_inDragMode) + return; + + dragWallSetEndPos(screenCoords); + } + + void onToolUp(WidgetIndex, const ScreenCoordsXY&) override + { + if (_sceneryPaintEnabled || gWindowSceneryEyedropperEnabled) + return; + + auto tabSelection = WindowSceneryGetTabSelection(); + auto sceneryType = tabSelection.SceneryType; + if (sceneryType == SCENERY_TYPE_WALL) + { + onToolUpWall(tabSelection.EntryIndex); + } + } + + void onToolUpWall(uint16_t selectedScenery) + { + removeProvisionalTilesFromMap(); + + if (!_inDragMode) + { + _provisionalTiles.clear(); + return; + } + + if (_provisionalTiles.empty()) + { + auto z = gSceneryPlaceZ > 0 ? gSceneryPlaceZ : TileElementHeight(_dragStartPos); + Audio::Play3D(Audio::SoundId::error, { _dragStartPos, z }); + + if (_lastProvisionalError.Error != GameActions::Status::Ok) + { + auto windowManager = Ui::GetWindowManager(); + windowManager->ShowError( + _lastProvisionalError.GetErrorTitle(), _lastProvisionalError.GetErrorMessage(), true); + } + + _inDragMode = false; + return; + } + + auto mapRange = getMapSelectRange(); + bool anySuccessful = false; + CoordsXYZ lastLocation = { mapRange.Point2, gSceneryPlaceZ }; + for (const auto& tile : _provisionalTiles) + { + auto wallPlaceAction = GameActions::WallPlaceAction( + selectedScenery, tile.location, tile.location.direction, _sceneryPrimaryColour, _scenerySecondaryColour, + _sceneryTertiaryColour); + + auto& gameState = getGameState(); + auto result = GameActions::Execute(&wallPlaceAction, gameState); + if (result.Error == GameActions::Status::Ok) + { + anySuccessful = true; + lastLocation = result.Position; + } + } + + _provisionalTiles.clear(); + _inDragMode = false; + + if (anySuccessful) + { + Audio::Play3D(Audio::SoundId::placeItem, lastLocation); + } } void onToolDownLargeScenery(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords, uint16_t selectedScenery) @@ -3223,6 +3420,13 @@ namespace OpenRCT2::Ui::Windows { if (_sceneryPaintEnabled || gWindowSceneryEyedropperEnabled) onToolDown(widgetIndex, screenCoords); + + auto tabSelection = WindowSceneryGetTabSelection(); + auto sceneryType = tabSelection.SceneryType; + if (sceneryType == SCENERY_TYPE_WALL) + { + onToolDragWall(screenCoords); + } } }; diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index 58b28e9282..6c9c1e99dd 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -193,7 +193,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gWindowSceneryScatterSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } } }; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 8297e5aa96..efcbc0cee1 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -248,7 +248,7 @@ namespace OpenRCT2::Ui::Windows } else { - const int32_t iconX = listWidget.width() - kScrollBarWidth - 7 - 10; + const int32_t iconX = listWidget.width() - 1 - kScrollBarWidth - 7 - 10; showNetworkVersionTooltip = screenCoords.x > iconX; } @@ -332,7 +332,7 @@ namespace OpenRCT2::Ui::Windows GfxClear(rt, paletteIndex); auto& listWidget = widgets[WIDX_LIST]; - int32_t listWidgetWidth = listWidget.width(); + int32_t listWidgetWidth = listWidget.width() - 1; ScreenCoordsXY screenCoords; screenCoords.y = 0; @@ -371,7 +371,7 @@ namespace OpenRCT2::Ui::Windows { snprintf(players, sizeof(players), "%d/%d", serverDetails.Players, serverDetails.MaxPlayers); } - const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::Medium); + const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::medium); // How much space we have for the server info depends on the size of everything rendered after. const int16_t spaceAvailableForInfo = listWidgetWidth - numPlayersStringWidth - kScrollBarWidth - 35; diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 9443b9efb9..a04b199b40 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -137,7 +137,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_STRING); ft.Add(_shortcutCustomName.c_str()); } - DrawTextWrapped(rt, stringCoords, 242, STR_SHORTCUT_CHANGE_PROMPT, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, 242, STR_SHORTCUT_CHANGE_PROMPT, ft, { TextAlignment::centre }); } private: diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index b028aca961..f0f906318d 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -135,7 +135,7 @@ namespace OpenRCT2::Ui::Windows Widget& viewportWidget = widgets[WIDX_VIEWPORT]; ViewportCreate( *this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, - viewportWidget.width() - 1, viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ })); + viewportWidget.width() - 2, viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ })); viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; invalidate(); @@ -318,7 +318,7 @@ namespace OpenRCT2::Ui::Windows Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; ViewportCreate( *this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, - viewportWidget->width() - 1, viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos })); + viewportWidget->width() - 2, viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos })); if (viewport != nullptr) viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; invalidate(); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 9352eec3c5..d62cfd78f6 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -563,8 +563,8 @@ namespace OpenRCT2::Ui::Windows staff->FormatActionTo(ft); const auto& widget = widgets[WIDX_BTM_LABEL]; auto screenPos = windowPos + ScreenCoordsXY{ widget.midX(), widget.top }; - int32_t widgetWidth = widget.width(); - DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); + int32_t widgetWidth = widget.width() - 1; + DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::centre }); } void DrawOverviewTabImage(RenderTarget& rt) @@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows return; const auto& widget = widgets[WIDX_TAB_1]; - int32_t widgetWidth = widget.width() - 1; + int32_t widgetWidth = widget.width() - 2; int32_t widgetHeight = widget.height() - 1; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; if (page == WINDOW_STAFF_OVERVIEW) @@ -615,7 +615,7 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr) { const Widget& viewportWidget = widgets[WIDX_VIEWPORT]; - const auto reqViewportWidth = viewportWidget.width() - 1; + const auto reqViewportWidth = viewportWidget.width() - 2; const auto reqViewportHeight = viewportWidget.height() - 1; viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }; @@ -803,7 +803,7 @@ namespace OpenRCT2::Ui::Windows auto ddPos = ScreenCoordsXY{ ddWidget->left + windowPos.x, ddWidget->top + windowPos.y }; int32_t ddHeight = ddWidget->height() + 1; - int32_t ddWidth = ddWidget->width() - 3; + int32_t ddWidth = ddWidget->width() - 4; WindowDropdownShowTextCustomWidth(ddPos, ddHeight, colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, ddWidth); // Set selection @@ -1158,7 +1158,7 @@ namespace OpenRCT2::Ui::Windows const auto& viewWidget = widgets[WIDX_VIEWPORT]; auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y }; - int32_t viewportWidth = viewWidget.width() - 1; + int32_t viewportWidth = viewWidget.width() - 2; int32_t viewportHeight = viewWidget.height() - 1; ViewportCreate(*this, screenPos, viewportWidth, viewportHeight, focus.value()); diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 8c3a79eb02..cf94694324 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -87,7 +87,7 @@ namespace OpenRCT2::Ui::Windows peep->FormatNameTo(ft); ScreenCoordsXY textCoords(windowPos + ScreenCoordsXY{ kWindowSize.width / 2, (kWindowSize.height / 2) - 3 }); - DrawTextWrapped(rt, textCoords, kWindowSize.width - 4, STR_FIRE_STAFF_ID, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, textCoords, kWindowSize.width - 4, STR_FIRE_STAFF_ID, ft, { TextAlignment::centre }); } }; diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 95d1a49008..ae05ddd7c2 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -322,7 +322,7 @@ namespace OpenRCT2::Ui::Windows invalidate(); } - auto scrollWidth = widgets[WIDX_STAFF_LIST_LIST].width() - 15; + auto scrollWidth = widgets[WIDX_STAFF_LIST_LIST].width() - 16; return { scrollWidth, scrollHeight }; } @@ -375,7 +375,7 @@ namespace OpenRCT2::Ui::Windows ColourMapA[colours[1].colour].mid_light); // How much space do we have for the name and action columns? (Discount scroll area and icons.) - const int32_t nonIconSpace = widgets[WIDX_STAFF_LIST_LIST].width() - 15 - 68; + const int32_t nonIconSpace = widgets[WIDX_STAFF_LIST_LIST].width() - 1 - 15 - 68; const int32_t nameColumnSize = nonIconSpace * 0.42; const int32_t actionColumnSize = nonIconSpace * 0.58; const int32_t actionOffset = widgets[WIDX_STAFF_LIST_LIST].right - actionColumnSize - 15; diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index d38ca289c3..7746bf6773 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -208,13 +208,13 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_description.c_str()); - DrawTextWrapped(rt, screenCoords, kWindowSize.width, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); + DrawTextWrapped(rt, screenCoords, kWindowSize.width, STR_STRING, ft, { colours[1], TextAlignment::centre }); } else { DrawTextWrapped( rt, screenCoords, kWindowSize.width, _descriptionStringId, _descriptionArgs, - { colours[1], TextAlignment::CENTRE }); + { colours[1], TextAlignment::centre }); } screenCoords.y += 25; @@ -223,7 +223,7 @@ namespace OpenRCT2::Ui::Windows // +13 for cursor when max length. u8string wrappedString; GfxWrapString( - u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::Medium, + u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::medium, &wrappedString, &no_lines); Rectangle::fillInset( @@ -245,7 +245,7 @@ namespace OpenRCT2::Ui::Windows for (int32_t line = 0; line <= no_lines; line++) { screenCoords.x = windowPos.x + 12; - DrawText(rt, screenCoords, { colours[1], FontStyle::Medium, TextAlignment::LEFT }, wrapPointer, true); + DrawText(rt, screenCoords, { colours[1], FontStyle::medium, TextAlignment::left }, wrapPointer, true); size_t string_length = GetStringSize(wrapPointer) - 1; if (!cur_drawn && (textInput->SelectionStart <= char_count + string_length)) @@ -253,7 +253,7 @@ namespace OpenRCT2::Ui::Windows // Make a view of the string for measuring the width. cursorX = windowPos.x + 13 + GfxGetStringWidthNoFormatting( - u8string_view{ wrapPointer, textInput->SelectionStart - char_count }, FontStyle::Medium); + u8string_view{ wrapPointer, textInput->SelectionStart - char_count }, FontStyle::medium); cursorY = screenCoords.y; int32_t textWidth = 6; @@ -264,7 +264,7 @@ namespace OpenRCT2::Ui::Windows utf8 tmp[5] = {}; // This is easier than setting temp_string[0..5] uint32_t codepoint = UTF8GetNext(_buffer.data() + textInput->SelectionStart, nullptr); UTF8WriteCodepoint(tmp, codepoint); - textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::Medium) - 2, 4); + textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::medium) - 2, 4); } if (_cursorBlink > 15) @@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows { // String length needs to add 12 either side of box +13 for cursor when max length. int32_t numLines{}; - GfxWrapString(text, kWindowSize.width - (24 + 13), FontStyle::Medium, nullptr, &numLines); + GfxWrapString(text, kWindowSize.width - (24 + 13), FontStyle::medium, nullptr, &numLines); const auto textHeight = numLines * 10; return kWindowSize.height + textHeight + getTitleBarDiffNormal(); diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 8321fc1b1b..42ab14757e 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -453,7 +454,7 @@ namespace OpenRCT2::Ui::Windows WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, num_items, widget->width() - 3); + Dropdown::Flag::StayOpen, num_items, widget->width() - 4); gDropdown.items[static_cast(ThemeManagerGetAvailableThemeIndex())].setChecked(true); break; @@ -702,7 +703,7 @@ namespace OpenRCT2::Ui::Windows else { auto colour = ThemeGetColour(wc, _buttonIndex); - colour.setFlag(ColourFlag::translucent, !colour.hasFlag(ColourFlag::translucent)); + colour.flags.flip(ColourFlag::translucent); ThemeSetColour(wc, _buttonIndex, colour); ColourSchemeUpdateAll(); @@ -721,7 +722,7 @@ namespace OpenRCT2::Ui::Windows if (_selectedTab == WINDOW_THEMES_TAB_SETTINGS || _selectedTab == WINDOW_THEMES_TAB_FEATURES) return; - if (!colours[1].hasFlag(ColourFlag::translucent)) + if (!colours[1].flags.has(ColourFlag::translucent)) // Rectangle::fill(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, // ColourMapA[colours[1].colour].mid_light); GfxClear(rt, ColourMapA[colours[1].colour].mid_light); @@ -759,7 +760,7 @@ namespace OpenRCT2::Ui::Windows screenCoords.y + _max_row_height - colorOffset + 1 }; auto yPixelOffset = ScreenCoordsXY{ 0, 1 }; - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) { TranslucentWindowPalette windowPalette = kTranslucentWindowPalettes[colour.colour]; @@ -799,10 +800,10 @@ namespace OpenRCT2::Ui::Windows Rectangle::fillInset( rt, { topLeft, bottomRight }, colours[1], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::dark, Rectangle::FillMode::dontLightenWhenInset); - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) { DrawText( - rt, topLeft, { colours[1].colour, FontStyle::Medium, TextDarkness::Dark }, kCheckMarkString); + rt, topLeft, { colours[1].colour, FontStyle::medium, TextDarkness::dark }, kCheckMarkString); } } } @@ -863,7 +864,7 @@ namespace OpenRCT2::Ui::Windows std::string str = FormatStringIDLegacy(format, args); - return GfxGetStringWidth(str, FontStyle::Medium); + return GfxGetStringWidth(str, FontStyle::medium); } int8_t GetTotalColoursUpTo(int8_t index) diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index d89e42f878..51a12de56c 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -905,7 +905,7 @@ static uint64_t PageDisabledWidgets[] = { gDropdown.items[2] = Dropdown::MenuLabel(STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT); WindowDropdownShowTextCustomWidth( { windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, - Dropdown::Flag::StayOpen, 3, widget->width() - 3); + Dropdown::Flag::StayOpen, 3, widget->width() - 4); // Set current value as checked gDropdown.items[tileElement->AsWall()->GetSlope()].setChecked(true); @@ -1060,12 +1060,12 @@ static uint64_t PageDisabledWidgets[] = { ft.Add(tileCoords.x); DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ 43, yOffset }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); ft = Formatter(); ft.Add(tileCoords.y); DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ 113, yOffset }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); } else { @@ -1586,7 +1586,7 @@ static uint64_t PageDisabledWidgets[] = { void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - const int32_t listWidth = widgets[WIDX_LIST].width(); + const int32_t listWidth = widgets[WIDX_LIST].width() - 1; Rectangle::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -1595,9 +1595,9 @@ static uint64_t PageDisabledWidgets[] = { { auto& listWidget = widgets[WIDX_LIST]; auto centrePos = ScreenCoordsXY{ listWidget.width() / 2, - (listWidget.height() - FontGetLineHeight(FontStyle::Medium)) / 2 }; + (listWidget.height() - FontGetLineHeight(FontStyle::medium)) / 2 }; auto ft = Formatter{}; - auto textPaint = TextPaint{ colours[1], TextAlignment::CENTRE }; + auto textPaint = TextPaint{ colours[1], TextAlignment::centre }; DrawTextWrapped(rt, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint); return; } diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index e6eb8a3e53..55b4041693 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 1df47588f6..62e6dac5ea 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/src/openrct2-ui/windows/TitleVersion.cpp b/src/openrct2-ui/windows/TitleVersion.cpp index 3f4b0263c0..fe9999d5f1 100644 --- a/src/openrct2-ui/windows/TitleVersion.cpp +++ b/src/openrct2-ui/windows/TitleVersion.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace OpenRCT2::Ui::Windows @@ -28,12 +29,12 @@ namespace OpenRCT2::Ui::Windows // Write name and version information const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true); DrawText(rt, windowPos, { whiteOutline }, gVersionInfoFull); - width = GfxGetStringWidth(gVersionInfoFull, FontStyle::Medium); + width = GfxGetStringWidth(gVersionInfoFull, FontStyle::medium); // Write platform information constexpr const char platformInfo[] = OPENRCT2_PLATFORM " (" OPENRCT2_ARCHITECTURE ")"; DrawText(rt, windowPos + ScreenCoordsXY(0, kListRowHeight), { whiteOutline }, platformInfo); - width = std::max(width, GfxGetStringWidth(platformInfo, FontStyle::Medium)) + kTextOffset; + width = std::max(width, GfxGetStringWidth(platformInfo, FontStyle::medium)) + kTextOffset; } }; diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index ddcc86ffdd..ceb503f1e3 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows TooltipWindow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) { _textWidth = FormatTextForTooltip(message); - _textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::Small)); + _textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::small)); width = _textWidth + 5; height = _textHeight + 4; @@ -130,7 +130,7 @@ namespace OpenRCT2::Ui::Windows // Text left = windowPos.x + ((width + 1) / 2) - 1; top = windowPos.y + 1; - DrawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::Small); + DrawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::small); } private: @@ -143,11 +143,11 @@ namespace OpenRCT2::Ui::Windows formattedMessage.args.Add(tempString.c_str()); const u8string tooltipTextUnwrapped = FormatStringIDLegacy(formattedMessage.str, formattedMessage.args.Data()); - auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::Small); + auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::small); textWidth = std::min(textWidth, 196); int32_t numLines; - textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::Small, &_tooltipText, &numLines); + textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::small, &_tooltipText, &numLines); _tooltipNumLines = numLines; return textWidth; } diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 1ea3a557e9..09b5ab78ed 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1297,7 +1298,7 @@ namespace OpenRCT2::Ui::Windows if (firstItem && widgetIndex == WIDX_SEPARATOR) continue; - totalWidth += widget->width() + 1; + totalWidth += widget->width(); firstItem = false; } return totalWidth; @@ -1317,7 +1318,7 @@ namespace OpenRCT2::Ui::Windows if (firstItem && widgetIndex == WIDX_SEPARATOR) continue; - auto widgetWidth = widget->width(); + auto widgetWidth = widget->width() - 1; widget->left = xPos; xPos += widgetWidth; widget->right = xPos; @@ -1422,7 +1423,7 @@ namespace OpenRCT2::Ui::Windows auto colour = ColourWithFlags{ COLOUR_DARK_ORANGE }.withFlag(ColourFlag::withOutline, true); DrawTextBasic( rt, screenPos + ScreenCoordsXY{ 26, 2 }, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, {}, - { colour, TextAlignment::RIGHT }); + { colour, TextAlignment::right }); } } @@ -1486,7 +1487,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(Network::GetNumVisiblePlayers()); auto colour = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true); - DrawTextBasic(rt, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::right }); } if (widgets[WIDX_ROTATE_ANTI_CLOCKWISE].type != WidgetType::empty) diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index 36df5ef85b..d4f9ec98a3 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -189,7 +189,7 @@ namespace OpenRCT2::Ui::Windows const auto titleBarBottom = widgets[WIDX_TITLE].bottom; const auto buttonTop = widgets[WIDX_PROMPT_DELETE].top; - const auto fontHeight = FontGetLineHeight(FontStyle::Medium); + const auto fontHeight = FontGetLineHeight(FontStyle::medium); const auto maxMessageHeight = buttonTop - titleBarBottom; const auto messageTop = titleBarBottom + (maxMessageHeight - fontHeight) / 2; @@ -198,7 +198,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_trackDesignFileReference->name.c_str()); DrawTextWrapped( rt, windowPos + ScreenCoordsXY{ width / 2, messageTop }, (width - 4), - STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); + STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::centre }); } }; /** diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 70a780a9fb..cc08d55099 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -45,9 +45,7 @@ namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = STR_STRING; static constexpr ScreenSize kWindowSize = { 200, 124 }; - constexpr int16_t kTrackMiniPreviewWidth = 168; - constexpr int16_t kTrackMiniPreviewHeight = 78; - constexpr uint16_t kTrackMiniPreviewSize = kTrackMiniPreviewWidth * kTrackMiniPreviewHeight; + static constexpr ScreenSize kTrackMiniPreviewSize = { 168, 78 }; static constexpr uint8_t kPaletteIndexColourEntrance = PaletteIndex::pi20; // White static constexpr uint8_t kPaletteIndexColourExit = PaletteIndex::pi10; // Black @@ -62,7 +60,8 @@ namespace OpenRCT2::Ui::Windows WIDX_ROTATE, WIDX_MIRROR, WIDX_SELECT_DIFFERENT_DESIGN, - WIDX_PRICE + WIDX_PRICE, + WIDX_PREVIEW, }; VALIDATE_GLOBAL_WIDX(WC_TRACK_DESIGN_PLACE, WIDX_ROTATE); @@ -70,13 +69,16 @@ namespace OpenRCT2::Ui::Windows // clang-format off static constexpr auto _trackPlaceWidgets = makeWidgets( makeWindowShim(kWindowTitle, kWindowSize), - makeWidget({173, 83}, { 24, 24}, WidgetType::flatBtn, WindowColour::primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ), - makeWidget({173, 59}, { 24, 24}, WidgetType::flatBtn, WindowColour::primary, ImageId(SPR_MIRROR_ARROW), STR_MIRROR_IMAGE_TIP ), - makeWidget({ 4, 109}, {192, 12}, WidgetType::button, WindowColour::primary, STR_SELECT_A_DIFFERENT_DESIGN, STR_GO_BACK_TO_DESIGN_SELECTION_WINDOW_TIP), - makeWidget({ 0, 0}, { 1, 1}, WidgetType::empty, WindowColour::primary) + makeWidget({173, 83}, { 24, 24}, WidgetType::flatBtn, WindowColour::primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ), + makeWidget({173, 59}, { 24, 24}, WidgetType::flatBtn, WindowColour::primary, ImageId(SPR_MIRROR_ARROW), STR_MIRROR_IMAGE_TIP ), + makeWidget({ 4, 109}, {192, 12}, WidgetType::button, WindowColour::primary, STR_SELECT_A_DIFFERENT_DESIGN, STR_GO_BACK_TO_DESIGN_SELECTION_WINDOW_TIP), + makeWidget({ 88, 93}, { 1, 1}, WidgetType::empty, WindowColour::primary), + makeWidget({ 4, 17}, kTrackMiniPreviewSize, WidgetType::empty, WindowColour::primary) ); // clang-format on + static bool _placingTrackDesign = false; + class TrackDesignPlaceWindow final : public Window { private: @@ -109,7 +111,7 @@ namespace OpenRCT2::Ui::Windows gInputFlags.set(InputFlag::unk6); WindowPushOthersRight(*this); ShowGridlines(); - _miniPreview.resize(kTrackMiniPreviewSize); + _miniPreview.resize(kTrackMiniPreviewSize.width * kTrackMiniPreviewSize.height); _placementCost = kMoney64Undefined; _placementLoc.SetNull(); _currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3; @@ -175,6 +177,11 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags.unset(MapSelectFlag::enableConstruct); gMapSelectFlags.unset(MapSelectFlag::enableArrow); + if (_placingTrackDesign) + { + return; + } + // Take shift modifier into account ScreenCoordsXY targetScreenCoords = screenCoords; if (_trackPlaceShiftState) @@ -212,25 +219,26 @@ namespace OpenRCT2::Ui::Windows if (GameIsNotPaused() || getGameState().cheats.buildInPauseMode) { ClearProvisional(); - auto res = FindValidTrackDesignPlaceHeight(trackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + CoordsXYZD ghostTrackLoc = trackLoc; + auto res = FindValidTrackDesignPlaceHeight(ghostTrackLoc, GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); if (res.Error == GameActions::Status::Ok) { // Valid location found. Place the ghost at the location. - auto tdAction = GameActions::TrackDesignAction(trackLoc, *_trackDesign, !gTrackDesignSceneryToggle); + auto tdAction = GameActions::TrackDesignAction(ghostTrackLoc, *_trackDesign, !gTrackDesignSceneryToggle); tdAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); tdAction.SetCallback([&](const GameActions::GameAction*, const GameActions::Result* result) { if (result->Error == GameActions::Status::Ok) { _placementGhostRideId = result->GetData(); - _placementGhostLoc = trackLoc; + _placementGhostLoc = ghostTrackLoc; _hasPlacementGhost = true; } }); res = GameActions::Execute(&tdAction, getGameState()); cost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined; - VirtualFloorSetHeight(trackLoc.z); + VirtualFloorSetHeight(ghostTrackLoc.z); } } @@ -287,12 +295,15 @@ namespace OpenRCT2::Ui::Windows return; } + _placingTrackDesign = true; + auto tdAction = GameActions::TrackDesignAction( { trackLoc, _currentTrackPieceDirection }, *_trackDesign, !gTrackDesignSceneryToggle); - tdAction.SetCallback([&](const GameActions::GameAction*, const GameActions::Result* result) { + tdAction.SetCallback([&, trackLoc](const GameActions::GameAction*, const GameActions::Result* result) { if (result->Error != GameActions::Status::Ok) { Audio::Play3D(Audio::SoundId::error, result->Position); + _placingTrackDesign = false; return; } @@ -321,6 +332,7 @@ namespace OpenRCT2::Ui::Windows wnd->onMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } } + _placingTrackDesign = false; }); GameActions::Execute(&tdAction, getGameState()); } @@ -348,12 +360,14 @@ namespace OpenRCT2::Ui::Windows // Draw mini tile preview RenderTarget clippedRT; - if (ClipDrawPixelInfo(clippedRT, rt, this->windowPos + ScreenCoordsXY{ 4, 18 }, 168, 78)) + const auto& previewWidget = widgets[WIDX_PREVIEW]; + const auto previewCoords = windowPos + ScreenCoordsXY{ previewWidget.left, previewWidget.top }; + if (ClipDrawPixelInfo(clippedRT, rt, previewCoords, previewWidget.width(), previewWidget.height())) { G1Element g1temp = {}; g1temp.offset = _miniPreview.data(); - g1temp.width = kTrackMiniPreviewWidth; - g1temp.height = kTrackMiniPreviewHeight; + g1temp.width = kTrackMiniPreviewSize.width; + g1temp.height = kTrackMiniPreviewSize.height; GfxSetG1Element(SPR_TEMP, &g1temp); DrawingEngineInvalidateImage(SPR_TEMP); GfxDrawSprite(clippedRT, ImageId(SPR_TEMP, this->colours[0].colour), { 0, 0 }); @@ -364,7 +378,9 @@ namespace OpenRCT2::Ui::Windows { ft = Formatter(); ft.Add(_placementCost); - DrawTextBasic(rt, this->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + const auto& priceWidget = widgets[WIDX_PRICE]; + const auto priceCoords = windowPos + ScreenCoordsXY{ priceWidget.left, priceWidget.top }; + DrawTextBasic(rt, priceCoords, STR_COST_LABEL, ft, { TextAlignment::centre }); } } @@ -723,7 +739,7 @@ namespace OpenRCT2::Ui::Windows uint8_t* DrawMiniPreviewGetPixelPtr(const ScreenCoordsXY& pixel) { - return &_miniPreview[pixel.y * kTrackMiniPreviewWidth + pixel.x]; + return &_miniPreview[pixel.y * kTrackMiniPreviewSize.width + pixel.x]; } GameActions::Result FindValidTrackDesignPlaceHeight(CoordsXYZ& loc, uint32_t newFlags) diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 0c68ebf317..d577872c25 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -476,7 +476,7 @@ namespace OpenRCT2::Ui::Windows // Show track file path (in debug mode) if (Config::Get().general.debuggingTools) { - const auto shortPath = ShortenPath(path, width, FontStyle::Medium); + const auto shortPath = ShortenPath(path, width, FontStyle::medium); auto ft = Formatter(); ft.Add(shortPath.c_str()); DrawTextBasic( @@ -523,7 +523,7 @@ namespace OpenRCT2::Ui::Windows && !(gLegacyScene == LegacyScene::trackDesignsManager)) { // Vehicle design not available - DrawTextEllipsised(rt, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::centre }); screenPos.y -= kScrollableRowHeight; } @@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows { // Scenery not available DrawTextEllipsised( - rt, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + rt, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::centre }); screenPos.y -= kScrollableRowHeight; } } @@ -541,7 +541,7 @@ namespace OpenRCT2::Ui::Windows // Track design name auto ft = Formatter(); ft.Add(_trackDesigns[trackIndex].name.c_str()); - DrawTextEllipsised(rt, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::centre }); // Information screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.bottom + 2 }; diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 9c536ef8f9..f6f0b320ee 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows { const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; const ScrollArea* const scroll = &this->scrolls[0]; - const int16_t scroll_width = widget.width() - 1; + const int16_t scroll_width = widget.width() - 2; const uint8_t clip_height = static_cast( (static_cast(scroll->contentOffsetX) / (scroll->contentWidth - scroll_width)) * 255); if (clip_height != gClipHeight) @@ -402,7 +402,7 @@ namespace OpenRCT2::Ui::Windows const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; const float clip_height_ratio = static_cast(gClipHeight) / 255; this->scrolls[0].contentOffsetX = static_cast( - std::ceil(clip_height_ratio * (this->scrolls[0].contentWidth - (widget.width() - 1)))); + std::ceil(clip_height_ratio * (this->scrolls[0].contentWidth - (widget.width() - 2)))); } bool IsActive() diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 8dee649d27..619b416560 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -199,7 +199,7 @@ namespace OpenRCT2::Ui::Windows { Widget* viewportWidget = &widgets[WIDX_VIEWPORT]; viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }; - viewport->width = widgets[WIDX_VIEWPORT].width() - 1; + viewport->width = widgets[WIDX_VIEWPORT].width() - 2; viewport->height = widgets[WIDX_VIEWPORT].height() - 1; } } diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 79313f9f7f..b8af23f4ad 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -161,7 +161,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) @@ -172,7 +172,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_waterToolRaiseCost); - DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::centre }); } screenCoords.y += 10; @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_waterToolLowerCost); - DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::centre }); } } } diff --git a/src/openrct2-win/openrct2-win.cpp b/src/openrct2-win/openrct2-win.cpp index d640e46f9a..d0e43aa3f5 100644 --- a/src/openrct2-win/openrct2-win.cpp +++ b/src/openrct2-win/openrct2-win.cpp @@ -8,6 +8,9 @@ *****************************************************************************/ // Windows.h needs to be included first +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include // Enable visual styles diff --git a/src/openrct2/ReplayManager.h b/src/openrct2/ReplayManager.h index c2286bf62f..d3f3a98bc0 100644 --- a/src/openrct2/ReplayManager.h +++ b/src/openrct2/ReplayManager.h @@ -9,6 +9,7 @@ #pragma once +#include #include #include #include diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp index e4c210f1ac..0d2d20fad1 100644 --- a/src/openrct2/actions/RideCreateAction.cpp +++ b/src/openrct2/actions/RideCreateAction.cpp @@ -31,13 +31,13 @@ namespace OpenRCT2::GameActions { RideCreateAction::RideCreateAction( - ride_type_t rideType, ObjectEntryIndex subType, colour_t colour1, colour_t colour2, + ride_type_t rideType, ObjectEntryIndex subType, uint8_t trackColourPreset, uint8_t vehicleColourPreset, ObjectEntryIndex entranceObjectIndex) : _rideType(rideType) , _subType(subType) , _entranceObjectIndex(entranceObjectIndex) - , _colour1(colour1) - , _colour2(colour2) + , _trackColourPreset(trackColourPreset) + , _vehicleColourPreset(vehicleColourPreset) { } @@ -46,8 +46,8 @@ namespace OpenRCT2::GameActions visitor.Visit("rideType", _rideType); visitor.Visit("rideObject", _subType); visitor.Visit("entranceObject", _entranceObjectIndex); - visitor.Visit("colour1", _colour1); - visitor.Visit("colour2", _colour2); + visitor.Visit("colour1", _trackColourPreset); + visitor.Visit("colour2", _vehicleColourPreset); } ride_type_t RideCreateAction::GetRideType() const @@ -69,7 +69,8 @@ namespace OpenRCT2::GameActions { GameAction::Serialise(stream); - stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_entranceObjectIndex) << DS_TAG(_colour1) << DS_TAG(_colour2); + stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_entranceObjectIndex) << DS_TAG(_trackColourPreset) + << DS_TAG(_vehicleColourPreset); } Result RideCreateAction::Query(GameState_t& gameState) const @@ -95,9 +96,9 @@ namespace OpenRCT2::GameActions } const auto& colourPresets = GetRideTypeDescriptor(_rideType).ColourPresets; - if (_colour1 >= colourPresets.count) + if (_trackColourPreset >= colourPresets.count) { - LOG_ERROR("Can't create ride, invalid colour preset %d", _colour1); + LOG_ERROR("Can't create ride, invalid colour preset %d", _trackColourPreset); return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_ERR_INVALID_COLOUR); } @@ -109,7 +110,7 @@ namespace OpenRCT2::GameActions } const auto* presetList = rideEntry->vehicle_preset_list; - if ((presetList->count > 0 && presetList->count != 255) && _colour2 >= presetList->count) + if ((presetList->count > 0 && presetList->count != 255) && _vehicleColourPreset >= presetList->count) { return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, kStringIdNone); } @@ -139,7 +140,7 @@ namespace OpenRCT2::GameActions ride->type = _rideType; ride->subtype = rideEntryIndex; - ride->setColourPreset(_colour1); + ride->setColourPreset(_trackColourPreset, _vehicleColourPreset); ride->overallView.SetNull(); ride->setNameToDefault(); @@ -288,7 +289,7 @@ namespace OpenRCT2::GameActions ride->mode = ride->getDefaultMode(); ride->minCarsPerTrain = rideEntry->min_cars_in_train; ride->maxCarsPerTrain = rideEntry->max_cars_in_train; - RideSetVehicleColoursToRandomPreset(*ride, _colour2); + RideSetVehicleColoursToRandomPreset(*ride, _vehicleColourPreset); auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::rideList); diff --git a/src/openrct2/actions/RideCreateAction.h b/src/openrct2/actions/RideCreateAction.h index fd881d9816..910bea53d6 100644 --- a/src/openrct2/actions/RideCreateAction.h +++ b/src/openrct2/actions/RideCreateAction.h @@ -19,13 +19,13 @@ namespace OpenRCT2::GameActions ride_type_t _rideType{ kRideTypeNull }; ObjectEntryIndex _subType{ kObjectEntryIndexNull }; ObjectEntryIndex _entranceObjectIndex{ kObjectEntryIndexNull }; - colour_t _colour1{ COLOUR_NULL }; - colour_t _colour2{ COLOUR_NULL }; + uint8_t _trackColourPreset{ COLOUR_NULL }; + uint8_t _vehicleColourPreset{ COLOUR_NULL }; public: RideCreateAction() = default; RideCreateAction( - ride_type_t rideType, ObjectEntryIndex subType, colour_t colour1, colour_t colour2, + ride_type_t rideType, ObjectEntryIndex subType, uint8_t trackColourPreset, uint8_t vehicleColourPreset, ObjectEntryIndex entranceStyleIndex); void AcceptParameters(GameActionParameterVisitor&) final; diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 68ebf70c47..7945788ac4 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -268,7 +268,7 @@ namespace OpenRCT2::GameActions res.Cost = wallEntry->price; - res.SetData(WallPlaceActionResult{}); + res.SetData(WallPlaceActionResult{ targetHeight }); return res; } diff --git a/src/openrct2/audio/AudioMixer.h b/src/openrct2/audio/AudioMixer.h index f59d87adef..0c09d99c4e 100644 --- a/src/openrct2/audio/AudioMixer.h +++ b/src/openrct2/audio/AudioMixer.h @@ -9,6 +9,7 @@ #pragma once +#include #include namespace OpenRCT2::Audio diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index b3dcc5d27b..a2fa8d867f 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -967,7 +967,7 @@ namespace OpenRCT2::Config std::string rct1Path = FindRCT1Path(); if (!rct1Path.empty()) { - Get().general.rct2Path = std::move(rct1Path); + Get().general.rct1Path = std::move(rct1Path); } return true; diff --git a/src/openrct2/core/Crypt.CNG.cpp b/src/openrct2/core/Crypt.CNG.cpp index dc1b096598..00b302256b 100644 --- a/src/openrct2/core/Crypt.CNG.cpp +++ b/src/openrct2/core/Crypt.CNG.cpp @@ -24,12 +24,17 @@ #include // clang-format off -// CNG: Cryptography API: Next Generation (CNG) -// available in Windows Vista onwards. -#include -#include -#include -constexpr bool NT_SUCCESS(NTSTATUS status) {return status >= 0;} + // windows.h needs to be included first + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include + + // CNG: Cryptography API: Next Generation (CNG) + // available in Windows Vista onwards. + #include + #include + constexpr bool NT_SUCCESS(NTSTATUS status) {return status >= 0;} // clang-format on using namespace OpenRCT2::Crypt; diff --git a/src/openrct2/core/Crypt.h b/src/openrct2/core/Crypt.h index 8694683c3e..d6f02e76e3 100644 --- a/src/openrct2/core/Crypt.h +++ b/src/openrct2/core/Crypt.h @@ -10,6 +10,7 @@ #pragma once #include +#include #include #include #include diff --git a/src/openrct2/core/Diagnostics.cpp b/src/openrct2/core/Diagnostics.cpp index a8840a9089..fec947d2ea 100644 --- a/src/openrct2/core/Diagnostics.cpp +++ b/src/openrct2/core/Diagnostics.cpp @@ -8,6 +8,9 @@ *****************************************************************************/ #if defined(DEBUG) && defined(_WIN32) + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #endif diff --git a/src/openrct2/core/File.cpp b/src/openrct2/core/File.cpp index 1296e1cba0..e0cad11152 100644 --- a/src/openrct2/core/File.cpp +++ b/src/openrct2/core/File.cpp @@ -8,6 +8,9 @@ *****************************************************************************/ #ifdef _WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #else #include diff --git a/src/openrct2/core/FileScanner.cpp b/src/openrct2/core/FileScanner.cpp index 936dbe64f3..74a3d54631 100644 --- a/src/openrct2/core/FileScanner.cpp +++ b/src/openrct2/core/FileScanner.cpp @@ -8,6 +8,9 @@ *****************************************************************************/ #ifdef _WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #include diff --git a/src/openrct2/core/FileWatcher.cpp b/src/openrct2/core/FileWatcher.cpp index c75dbee056..5deb35db46 100644 --- a/src/openrct2/core/FileWatcher.cpp +++ b/src/openrct2/core/FileWatcher.cpp @@ -15,6 +15,9 @@ #include #ifdef _WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #elif defined(__linux__) #include diff --git a/src/openrct2/core/FlagHolder.hpp b/src/openrct2/core/FlagHolder.hpp index b8d443c970..a63ac37620 100644 --- a/src/openrct2/core/FlagHolder.hpp +++ b/src/openrct2/core/FlagHolder.hpp @@ -67,6 +67,22 @@ struct FlagHolder holder |= EnumsToFlags(types...); } + template + constexpr FlagHolder with(TTypes... types) + { + FlagHolder res = *this; + res.set(types...); + return res; + } + + template + constexpr FlagHolder without(TTypes... types) + { + FlagHolder res = *this; + res.unset(types...); + return res; + } + /** * For situations where you don’t know upfront whether to set or unset the flag, * e.g. in game actions where this is passed as a variable. diff --git a/src/openrct2/core/Guard.cpp b/src/openrct2/core/Guard.cpp index dc318c885a..2eb1598e69 100644 --- a/src/openrct2/core/Guard.cpp +++ b/src/openrct2/core/Guard.cpp @@ -8,7 +8,9 @@ *****************************************************************************/ #ifdef _WIN32 - #include + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #endif diff --git a/src/openrct2/core/Http.WinHttp.cpp b/src/openrct2/core/Http.WinHttp.cpp index a18cc5a733..b4a53c7f3d 100644 --- a/src/openrct2/core/Http.WinHttp.cpp +++ b/src/openrct2/core/Http.WinHttp.cpp @@ -17,6 +17,10 @@ #include #include + + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #include diff --git a/src/openrct2/core/OrcaStream.hpp b/src/openrct2/core/OrcaStream.hpp index 519dccd7ad..16f31d7ab9 100644 --- a/src/openrct2/core/OrcaStream.hpp +++ b/src/openrct2/core/OrcaStream.hpp @@ -671,7 +671,10 @@ namespace OpenRCT2 { len = s.size(); } - _buffer.Write(s.data(), len); + if (len > 0) + { + _buffer.Write(s.data(), len); + } _buffer.Write(&nullt, sizeof(nullt)); } diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp index 5efccf8649..10218ef8e0 100644 --- a/src/openrct2/core/String.cpp +++ b/src/openrct2/core/String.cpp @@ -27,6 +27,9 @@ #include #include #else + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #endif diff --git a/src/openrct2/core/Zip.h b/src/openrct2/core/Zip.h index b8c3c656ca..d1c811bc67 100644 --- a/src/openrct2/core/Zip.h +++ b/src/openrct2/core/Zip.h @@ -9,6 +9,7 @@ #pragma once +#include #include #include #include diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index 4961dcf6a4..0c151260f5 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -7,6 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "../drawing/Drawing.String.h" + #include "../Context.h" #include "../SpriteIds.h" #include "../config/Config.h" @@ -17,6 +19,7 @@ #include "../drawing/IDrawingContext.h" #include "../drawing/IDrawingEngine.h" #include "../drawing/Text.h" +#include "../interface/ColourWithFlags.h" #include "../interface/Viewport.h" #include "../localisation/Formatting.h" #include "../localisation/LocalisationService.h" @@ -264,14 +267,14 @@ void GfxDrawStringLeftCentred( char buffer[512]; auto bufferPtr = buffer; FormatStringLegacy(bufferPtr, sizeof(buffer), format, args); - int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::Medium); + int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::medium); DrawText(rt, coords - ScreenCoordsXY{ 0, (height / 2) }, { colour }, bufferPtr); } /** * Changes the palette so that the next character changes colour */ -static void ColourCharacter(TextColour colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacter(TextColour colour, bool withOutline, uint8_t* palette_pointer) { int32_t colour32 = 0; const G1Element* g1 = GfxGetG1Element(SPR_TEXT_PALETTE); @@ -281,7 +284,7 @@ static void ColourCharacter(TextColour colour, const uint16_t* current_font_flag std::memcpy(&colour32, &g1->offset[idx], sizeof(colour32)); } - if (!(*current_font_flags & TEXT_DRAW_FLAG_OUTLINE)) + if (!withOutline) { colour32 = colour32 & 0x0FF0000FF; } @@ -296,12 +299,12 @@ static void ColourCharacter(TextColour colour, const uint16_t* current_font_flag * Changes the palette so that the next character changes colour * This is specific to changing to a predefined window related colour */ -static void ColourCharacterWindow(colour_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacterWindow(colour_t colour, bool withOutline, uint8_t* palette_pointer) { int32_t eax; eax = ColourMapA[colour].colour_11; - if (*current_font_flags & TEXT_DRAW_FLAG_OUTLINE) + if (withOutline) { eax |= 0x0A0A00; } @@ -350,9 +353,9 @@ void DrawStringCentredRaw( int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) { int32_t height = 0; - if (fontStyle <= FontStyle::Medium) + if (fontStyle <= FontStyle::medium) height += 10; - else if (fontStyle == FontStyle::Tiny) + else if (fontStyle == FontStyle::tiny) height += 6; FmtString fmt(text); @@ -361,13 +364,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) switch (token.kind) { case FormatToken::newline: - if (fontStyle == FontStyle::Small || fontStyle == FontStyle::Medium) + if (fontStyle == FontStyle::small || fontStyle == FontStyle::medium) { height += 10; break; } - if (fontStyle == FontStyle::Tiny) + if (fontStyle == FontStyle::tiny) { height += 6; break; @@ -375,13 +378,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) height += 18; break; case FormatToken::newlineSmall: - if (fontStyle == FontStyle::Small || fontStyle == FontStyle::Medium) + if (fontStyle == FontStyle::small || fontStyle == FontStyle::medium) { height += 5; break; } - if (fontStyle == FontStyle::Tiny) + if (fontStyle == FontStyle::tiny) { height += 3; break; @@ -389,13 +392,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) height += 9; break; case FormatToken::fontTiny: - fontStyle = FontStyle::Tiny; + fontStyle = FontStyle::tiny; break; case FormatToken::fontMedium: - fontStyle = FontStyle::Medium; + fontStyle = FontStyle::medium; break; case FormatToken::fontSmall: - fontStyle = FontStyle::Small; + fontStyle = FontStyle::small; break; default: break; @@ -427,8 +430,8 @@ void DrawNewsTicker( DrawText(rt, screenCoords, { colour }, ""); u8string wrappedString; - GfxWrapString(FormatStringID(format, args), width, FontStyle::Small, &wrappedString, &numLines); - lineHeight = FontGetLineHeight(FontStyle::Small); + GfxWrapString(FormatStringID(format, args), width, FontStyle::small, &wrappedString, &numLines); + lineHeight = FontGetLineHeight(FontStyle::small); int32_t numCharactersDrawn = 0; int32_t numCharactersToDraw = ticks; @@ -437,7 +440,7 @@ void DrawNewsTicker( lineY = coords.y - ((numLines * lineHeight) / 2); for (int32_t line = 0; line <= numLines; line++) { - int32_t halfWidth = GfxGetStringWidth(buffer, FontStyle::Small) / 2; + int32_t halfWidth = GfxGetStringWidth(buffer, FontStyle::small) / 2; FmtString fmt(buffer); for (const auto& token : fmt) @@ -463,7 +466,7 @@ void DrawNewsTicker( } screenCoords = { coords.x - halfWidth, lineY }; - DrawText(rt, screenCoords, { kTextColour254, FontStyle::Small }, buffer); + DrawText(rt, screenCoords, { kTextColour254, FontStyle::small }, buffer); if (numCharactersDrawn > numCharactersToDraw) { @@ -477,15 +480,15 @@ void DrawNewsTicker( static void TTFDrawCharacterSprite(RenderTarget& rt, int32_t codepoint, TextDrawInfo* info) { - int32_t characterWidth = FontSpriteGetCodepointWidth(info->FontStyle, codepoint); - auto sprite = FontSpriteGetCodepointSprite(info->FontStyle, codepoint); + int32_t characterWidth = FontSpriteGetCodepointWidth(info->fontStyle, codepoint); + auto sprite = FontSpriteGetCodepointSprite(info->fontStyle, codepoint); - if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) + if (!info->textDrawFlags.has(TextDrawFlag::noDraw)) { auto screenCoords = ScreenCoordsXY{ info->x, info->y }; - if (info->flags & TEXT_DRAW_FLAG_Y_OFFSET_EFFECT) + if (info->textDrawFlags.has(TextDrawFlag::yOffsetEffect)) { - screenCoords.y += *info->y_offset++; + screenCoords.y += *info->yOffset++; } PaletteMap paletteMap(info->palette); @@ -511,14 +514,14 @@ static void TTFDrawStringRawTTF(RenderTarget& rt, std::string_view text, TextDra if (!TTFInitialise()) return; - TTFFontDescriptor* fontDesc = TTFGetFontFromSpriteBase(info->FontStyle); + TTFFontDescriptor* fontDesc = TTFGetFontFromSpriteBase(info->fontStyle); if (fontDesc->font == nullptr) { TTFDrawStringRawSprite(rt, text, info); return; } - if (info->flags & TEXT_DRAW_FLAG_NO_DRAW) + if (info->textDrawFlags.has(TextDrawFlag::noDraw)) { info->x += TTFGetWidthCacheGetOrAdd(fontDesc->font, text); return; @@ -551,43 +554,40 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token break; case FormatToken::newline: info->x = info->startX; - info->y += FontGetLineHeight(info->FontStyle); + info->y += FontGetLineHeight(info->fontStyle); break; case FormatToken::newlineSmall: info->x = info->startX; - info->y += FontGetLineHeightSmall(info->FontStyle); + info->y += FontGetLineHeightSmall(info->fontStyle); break; case FormatToken::fontTiny: - info->FontStyle = FontStyle::Tiny; + info->fontStyle = FontStyle::tiny; break; case FormatToken::fontSmall: - info->FontStyle = FontStyle::Small; + info->fontStyle = FontStyle::small; break; case FormatToken::fontMedium: - info->FontStyle = FontStyle::Medium; + info->fontStyle = FontStyle::medium; break; case FormatToken::outlineEnable: - info->flags |= TEXT_DRAW_FLAG_OUTLINE; + info->colourFlags.set(ColourFlag::withOutline); break; case FormatToken::outlineDisable: - info->flags &= ~TEXT_DRAW_FLAG_OUTLINE; + info->colourFlags.unset(ColourFlag::withOutline); break; case FormatToken::colourWindow1: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[0], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[0], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::colourWindow2: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[1], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[1], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::colourWindow3: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[2], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[2], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::inlineSprite: @@ -596,7 +596,7 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token auto g1 = GfxGetG1Element(imageId); if (g1 != nullptr && g1->width <= 32 && g1->height <= 32) { - if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) + if (!info->textDrawFlags.has(TextDrawFlag::noDraw)) { GfxDrawSprite(rt, imageId, { info->x, info->y }); } @@ -607,9 +607,8 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token default: if (FormatTokenIsColour(token.kind)) { - uint16_t flags = info->flags; auto colourIndex = FormatTokenToTextColour(token.kind); - ColourCharacter(colourIndex, &flags, info->palette); + ColourCharacter(colourIndex, info->colourFlags.has(ColourFlag::withOutline), info->palette); } break; } @@ -649,7 +648,7 @@ static bool ShouldUseSpriteForCodepoint(char32_t codepoint) static void TTFProcessStringLiteral(RenderTarget& rt, std::string_view text, TextDrawInfo* info) { #ifndef DISABLE_TTF - bool isTTF = info->flags & TEXT_DRAW_FLAG_TTF; + bool isTTF = info->textDrawFlags.has(TextDrawFlag::ttf); #else bool isTTF = false; #endif // DISABLE_TTF @@ -717,7 +716,7 @@ static void TTFProcessStringCodepoint(RenderTarget& rt, codepoint_t codepoint, T static void TTFProcessString(RenderTarget& rt, std::string_view text, TextDrawInfo* info) { - if (info->flags & TEXT_DRAW_FLAG_NO_FORMATTING) + if (info->textDrawFlags.has(TextDrawFlag::noFormatting)) { TTFProcessStringLiteral(rt, text, info); info->maxX = std::max(info->maxX, info->x); @@ -751,44 +750,34 @@ static void TTFProcessInitialColour(ColourWithFlags colour, TextDrawInfo* info) { if (colour.colour != kTextColour254 && colour.colour != kTextColour255) { - info->flags &= ~(TEXT_DRAW_FLAG_INSET | TEXT_DRAW_FLAG_OUTLINE); - if (colour.hasFlag(ColourFlag::withOutline)) + info->colourFlags = colour.flags; + if (!colour.flags.has(ColourFlag::inset)) { - info->flags |= TEXT_DRAW_FLAG_OUTLINE; - } - if (!colour.hasFlag(ColourFlag::inset)) - { - if (!(info->flags & TEXT_DRAW_FLAG_INSET)) - { - uint16_t flags = info->flags; - ColourCharacterWindow(colour.colour, &flags, reinterpret_cast(&info->palette)); - } + ColourCharacterWindow( + colour.colour, info->colourFlags.has(ColourFlag::withOutline), reinterpret_cast(&info->palette)); } else { - info->flags |= TEXT_DRAW_FLAG_INSET; - - uint32_t eax; - if (info->flags & TEXT_DRAW_FLAG_DARK) + uint32_t eax = 0; + switch (info->darkness) { - if (info->flags & TEXT_DRAW_FLAG_EXTRA_DARK) - { + case TextDarkness::extraDark: eax = ColourMapA[colour.colour].mid_light; eax = eax << 16; eax = eax | ColourMapA[colour.colour].dark; - } - else - { + break; + + case TextDarkness::dark: eax = ColourMapA[colour.colour].light; eax = eax << 16; eax = eax | ColourMapA[colour.colour].mid_dark; - } - } - else - { - eax = ColourMapA[colour.colour].lighter; - eax = eax << 16; - eax = eax | ColourMapA[colour.colour].mid_light; + break; + + case TextDarkness::regular: + eax = ColourMapA[colour.colour].lighter; + eax = eax << 16; + eax = eax | ColourMapA[colour.colour].mid_light; + break; } // Adjust text palette. Store current colour? ; @@ -807,31 +796,22 @@ void TTFDrawString( if (text == nullptr) return; - TextDrawInfo info; - info.FontStyle = fontStyle; - info.flags = 0; + TextDrawInfo info{}; + info.fontStyle = fontStyle; info.startX = coords.x; info.startY = coords.y; info.x = coords.x; info.y = coords.y; + info.darkness = darkness; if (LocalisationService_UseTrueTypeFont()) { - info.flags |= TEXT_DRAW_FLAG_TTF; + info.textDrawFlags.set(TextDrawFlag::ttf); } if (noFormatting) { - info.flags |= TEXT_DRAW_FLAG_NO_FORMATTING; - } - - if (darkness == TextDarkness::Dark) - { - info.flags |= TEXT_DRAW_FLAG_DARK; - } - else if (darkness == TextDarkness::ExtraDark) - { - info.flags |= (TEXT_DRAW_FLAG_DARK | TEXT_DRAW_FLAG_EXTRA_DARK); + info.textDrawFlags.set(TextDrawFlag::noFormatting); } std::memcpy(info.palette, gTextPalette, sizeof(info.palette)); @@ -844,9 +824,8 @@ void TTFDrawString( static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, bool noFormatting) { - TextDrawInfo info; - info.FontStyle = fontStyle; - info.flags = 0; + TextDrawInfo info{}; + info.fontStyle = fontStyle; info.startX = 0; info.startY = 0; info.x = 0; @@ -854,15 +833,15 @@ static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, boo info.maxX = 0; info.maxY = 0; - info.flags |= TEXT_DRAW_FLAG_NO_DRAW; + info.textDrawFlags.set(TextDrawFlag::noDraw); if (LocalisationService_UseTrueTypeFont()) { - info.flags |= TEXT_DRAW_FLAG_TTF; + info.textDrawFlags.set(TextDrawFlag::ttf); } if (noFormatting) { - info.flags |= TEXT_DRAW_FLAG_NO_FORMATTING; + info.textDrawFlags.set(TextDrawFlag::noFormatting); } RenderTarget dummy{}; @@ -879,20 +858,19 @@ void GfxDrawStringWithYOffsets( RenderTarget& rt, const utf8* text, ColourWithFlags colour, const ScreenCoordsXY& coords, const int8_t* yOffsets, bool forceSpriteFont, FontStyle fontStyle) { - TextDrawInfo info; - info.FontStyle = fontStyle; - info.flags = 0; + TextDrawInfo info{}; + info.fontStyle = fontStyle; info.startX = coords.x; info.startY = coords.y; info.x = coords.x; info.y = coords.y; - info.y_offset = yOffsets; + info.yOffset = yOffsets; - info.flags |= TEXT_DRAW_FLAG_Y_OFFSET_EFFECT; + info.textDrawFlags.set(TextDrawFlag::yOffsetEffect); if (!forceSpriteFont && LocalisationService_UseTrueTypeFont()) { - info.flags |= TEXT_DRAW_FLAG_TTF; + info.textDrawFlags.set(TextDrawFlag::ttf); } std::memcpy(info.palette, gTextPalette, sizeof(info.palette)); diff --git a/src/openrct2/drawing/Drawing.String.h b/src/openrct2/drawing/Drawing.String.h new file mode 100644 index 0000000000..8ef8e1432c --- /dev/null +++ b/src/openrct2/drawing/Drawing.String.h @@ -0,0 +1,44 @@ +/***************************************************************************** + * 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. + *****************************************************************************/ + +#pragma once + +#include "../core/FlagHolder.hpp" +#include "../interface/Colour.h" +#include "../interface/ColourWithFlags.h" + +#include + +enum class FontStyle : uint8_t; +enum class TextDarkness : uint8_t; + +enum class TextDrawFlag : uint8_t +{ + noFormatting, + yOffsetEffect, + ttf, + noDraw, +}; +using TextDrawFlags = FlagHolder; + +struct TextDrawInfo +{ + int32_t startX{}; + int32_t startY{}; + int32_t x{}; + int32_t y{}; + int32_t maxX{}; + int32_t maxY{}; + TextDrawFlags textDrawFlags{}; + OpenRCT2::ColourFlags colourFlags{}; + TextDarkness darkness{}; + uint8_t palette[8]{}; + FontStyle fontStyle{}; + const int8_t* yOffset{}; +}; diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 7e74dd397b..c32f59fdac 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -1139,8 +1139,8 @@ void DebugDPI(RenderTarget& rt) GfxDrawLine(rt, { topLeft, topLeft + ScreenCoordsXY{ 4, 0 } }, PaletteIndex::pi136); const auto str = std::to_string(rt.x); - DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::Tiny }, str.c_str()); + DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::tiny }, str.c_str()); const auto str2 = std::to_string(rt.y); - DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::Tiny }, str2.c_str()); + DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::tiny }, str2.c_str()); } diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 54f5a96810..ca70996546 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -32,6 +32,7 @@ struct ScreenRect; namespace OpenRCT2 { + struct ColourWithFlags; struct IPlatformEnvironment; struct IStream; } // namespace OpenRCT2 @@ -113,32 +114,6 @@ struct RenderTarget } }; -struct TextDrawInfo -{ - int32_t startX; - int32_t startY; - int32_t x; - int32_t y; - int32_t maxX; - int32_t maxY; - int32_t flags; - uint8_t palette[8]; - ::FontStyle FontStyle; - const int8_t* y_offset; -}; - -enum : uint32_t -{ - TEXT_DRAW_FLAG_INSET = 1 << 0, - TEXT_DRAW_FLAG_OUTLINE = 1 << 1, - TEXT_DRAW_FLAG_DARK = 1 << 2, - TEXT_DRAW_FLAG_EXTRA_DARK = 1 << 3, - TEXT_DRAW_FLAG_NO_FORMATTING = 1 << 28, - TEXT_DRAW_FLAG_Y_OFFSET_EFFECT = 1 << 29, - TEXT_DRAW_FLAG_TTF = 1 << 30, - TEXT_DRAW_FLAG_NO_DRAW = 1u << 31 -}; - struct RCTG1Element { uint32_t offset; // 0x00 note: uint32_t always! diff --git a/src/openrct2/drawing/Font.h b/src/openrct2/drawing/Font.h index e85678cb8f..fda084eee8 100644 --- a/src/openrct2/drawing/Font.h +++ b/src/openrct2/drawing/Font.h @@ -18,13 +18,13 @@ constexpr uint16_t kSpriteFontGlyphCount = 224; enum class FontStyle : uint8_t { - Small = 0, - Medium = 1, - Tiny = 2, + small = 0, + medium = 1, + tiny = 2, }; constexpr uint8_t FontStyleCount = 3; -constexpr std::array FontStyles = { FontStyle::Small, FontStyle::Medium, FontStyle::Tiny }; +constexpr std::array FontStyles = { FontStyle::small, FontStyle::medium, FontStyle::tiny }; #ifndef DISABLE_TTF diff --git a/src/openrct2/drawing/IDrawingContext.h b/src/openrct2/drawing/IDrawingContext.h index 4dd944fda5..5183296d4f 100644 --- a/src/openrct2/drawing/IDrawingContext.h +++ b/src/openrct2/drawing/IDrawingContext.h @@ -12,6 +12,8 @@ #include "Drawing.h" #include "TTF.h" +struct TextDrawInfo; + namespace OpenRCT2::Drawing { struct IDrawingEngine; diff --git a/src/openrct2/drawing/Rectangle.cpp b/src/openrct2/drawing/Rectangle.cpp index db5992c93e..d0bb871490 100644 --- a/src/openrct2/drawing/Rectangle.cpp +++ b/src/openrct2/drawing/Rectangle.cpp @@ -10,6 +10,7 @@ #include "Rectangle.h" #include "../interface/Colour.h" +#include "../interface/ColourWithFlags.h" #include "../world/Location.hpp" #include "Drawing.h" #include "IDrawingContext.h" @@ -49,7 +50,7 @@ namespace OpenRCT2::Drawing::Rectangle const auto leftBottom = ScreenCoordsXY{ rect.GetLeft(), rect.GetBottom() }; const auto rightTop = ScreenCoordsXY{ rect.GetRight(), rect.GetTop() }; const auto rightBottom = ScreenCoordsXY{ rect.GetRight(), rect.GetBottom() }; - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) { auto palette = kTranslucentWindowPalettes[colour.colour]; diff --git a/src/openrct2/drawing/Rectangle.h b/src/openrct2/drawing/Rectangle.h index f33629a41e..170be7df2a 100644 --- a/src/openrct2/drawing/Rectangle.h +++ b/src/openrct2/drawing/Rectangle.h @@ -11,11 +11,15 @@ #include -struct ColourWithFlags; enum class FilterPaletteID : int32_t; struct RenderTarget; struct ScreenRect; +namespace OpenRCT2 +{ + struct ColourWithFlags; +} + namespace OpenRCT2::Drawing::Rectangle { enum class BorderStyle : uint8_t diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index 3b571802ba..1f1f463b15 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -59,7 +59,7 @@ static void ScrollingTextInitialiseCharacterBitmaps(uint32_t glyphStart, uint16_ for (int32_t i = 0; i < count; i++) { std::fill_n(drawingSurface, sizeof(drawingSurface), 0x00); - GfxDrawSpriteSoftware(rt, ImageId(glyphStart + (EnumValue(FontStyle::Tiny) * count) + i), { -1, 0 }); + GfxDrawSpriteSoftware(rt, ImageId(glyphStart + (EnumValue(FontStyle::tiny) * count) + i), { -1, 0 }); for (int32_t x = 0; x < 8; x++) { @@ -1493,7 +1493,7 @@ static void ScrollingTextSetBitmapForSprite( CodepointView codepoints(token.text); for (auto codepoint : codepoints) { - auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::Tiny, codepoint); + auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::tiny, codepoint); auto characterBitmap = FontSpriteGetCodepointBitmap(codepoint); for (; characterWidth != 0; characterWidth--, characterBitmap++) { @@ -1541,7 +1541,7 @@ static void ScrollingTextSetBitmapForTTF( std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour) { #ifndef DISABLE_TTF - auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::Tiny); + auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::tiny); if (fontDesc->font == nullptr) { ScrollingTextSetBitmapForSprite(text, scroll, bitmap, scrollPositionOffsets, colour); diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 03e3c04b10..5f377b5373 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -43,12 +43,12 @@ public: auto lineCoords = coords; switch (Paint.Alignment) { - case TextAlignment::LEFT: + case TextAlignment::left: break; - case TextAlignment::CENTRE: + case TextAlignment::centre: lineCoords.x += MaxWidth / 2; break; - case TextAlignment::RIGHT: + case TextAlignment::right: lineCoords.x += MaxWidth; break; } @@ -86,19 +86,19 @@ void DrawText(RenderTarget& rt, const ScreenCoordsXY& coords, const TextPaint& p auto alignedCoords = coords; switch (paint.Alignment) { - case TextAlignment::LEFT: + case TextAlignment::left: break; - case TextAlignment::CENTRE: + case TextAlignment::centre: alignedCoords.x -= (width - 1) / 2; break; - case TextAlignment::RIGHT: + case TextAlignment::right: alignedCoords.x -= width; break; } TTFDrawString(rt, text, paint.Colour, alignedCoords, noFormatting, paint.FontStyle, paint.Darkness); - if (paint.UnderlineText == TextUnderline::On) + if (paint.UnderlineText == TextUnderline::on) { Rectangle::fill( rt, { { alignedCoords + ScreenCoordsXY{ 0, 11 } }, { alignedCoords + ScreenCoordsXY{ width, 11 } } }, @@ -157,7 +157,7 @@ int32_t DrawTextWrapped( StaticLayout layout(OpenRCT2::FormatStringIDLegacy(format, args), textPaint, width); - if (textPaint.Alignment == TextAlignment::CENTRE) + if (textPaint.Alignment == TextAlignment::centre) { // The original tried to vertically centre the text, but used line count - 1 int32_t lineCount = layout.GetLineCount(); diff --git a/src/openrct2/drawing/Text.h b/src/openrct2/drawing/Text.h index d3606fa906..35f78423ce 100644 --- a/src/openrct2/drawing/Text.h +++ b/src/openrct2/drawing/Text.h @@ -10,12 +10,15 @@ #pragma once #include "../interface/Colour.h" +#include "../interface/ColourWithFlags.h" #include "../localisation/StringIdType.h" #include "Font.h" struct ScreenCoordsXY; struct RenderTarget; +using OpenRCT2::ColourWithFlags; + namespace OpenRCT2 { class Formatter; @@ -23,31 +26,31 @@ namespace OpenRCT2 enum class TextAlignment { - LEFT, - CENTRE, - RIGHT + left, + centre, + right, }; enum class TextUnderline { - Off, - On, + off, + on, }; -enum class TextDarkness +enum class TextDarkness : uint8_t { - Regular = 0, - Dark = 1, - ExtraDark = 2, + regular = 0, + dark = 1, + extraDark = 2, }; struct TextPaint { ColourWithFlags Colour = { COLOUR_BLACK }; - ::FontStyle FontStyle = FontStyle::Medium; - TextUnderline UnderlineText = TextUnderline::Off; - TextAlignment Alignment = TextAlignment::LEFT; - TextDarkness Darkness = TextDarkness::Regular; + ::FontStyle FontStyle = FontStyle::medium; + TextUnderline UnderlineText = TextUnderline::off; + TextAlignment Alignment = TextAlignment::left; + TextDarkness Darkness = TextDarkness::regular; TextPaint() = default; TextPaint(ColourWithFlags colour) diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index fc8731e7bb..d3aa7e21f4 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -18,6 +18,7 @@ #include "../interface/Window.h" #include "../scenes/intro/IntroScene.h" #include "../ui/UiContext.h" +#include "Drawing.String.h" #include "Drawing.h" #include "IDrawingContext.h" #include "IDrawingEngine.h" @@ -746,14 +747,14 @@ void X8DrawingContext::DrawTTFBitmap( const uint8_t fgColor = info->palette[1]; const uint8_t bgColor = info->palette[3]; - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + if (info->colourFlags.has(ColourFlag::withOutline)) { DrawTTFBitmapInternal(rt, bgColor, surface, x + 1, y, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x - 1, y, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x, y + 1, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x, y - 1, 0); } - if (info->flags & TEXT_DRAW_FLAG_INSET) + if (info->colourFlags.has(ColourFlag::inset)) { DrawTTFBitmapInternal(rt, bgColor, surface, x + 1, y + 1, 0); } diff --git a/src/openrct2/drawing/X8DrawingEngine.h b/src/openrct2/drawing/X8DrawingEngine.h index 6ed83b1f1a..a0825c35f7 100644 --- a/src/openrct2/drawing/X8DrawingEngine.h +++ b/src/openrct2/drawing/X8DrawingEngine.h @@ -15,6 +15,8 @@ #include +struct TextDrawInfo; + namespace OpenRCT2 { namespace Ui diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index d96e87ea49..cac1ffb4d0 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -108,7 +108,7 @@ void MoneyEffect::SetValue(money64 value) auto [stringId, newValue] = GetStringId(); char buffer[128]; OpenRCT2::FormatStringLegacy(buffer, 128, stringId, &newValue); - offsetX = -(GfxGetStringWidth(buffer, FontStyle::Medium) / 2); + offsetX = -(GfxGetStringWidth(buffer, FontStyle::medium) / 2); } OffsetX = offsetX; Wiggle = 0; diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 743729cf25..c98d838b89 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -17,6 +17,7 @@ #include "../drawing/Drawing.h" #include "../drawing/Rectangle.h" #include "../drawing/Text.h" +#include "../interface/ColourWithFlags.h" #include "../localisation/Formatter.h" #include "../localisation/Formatting.h" #include "../network/Network.h" @@ -198,10 +199,10 @@ void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColor) GfxSetDirtyBlocks({ screenCoords, { screenCoords + ScreenCoordsXY{ _chatWidth, inputLineHeight + 15 } } }); // TODO: Show caret if the input text has multiple lines - if (_chatCaretTicks < 15 && GfxGetStringWidth(lineBuffer, FontStyle::Medium) < (_chatWidth - 10)) + if (_chatCaretTicks < 15 && GfxGetStringWidth(lineBuffer, FontStyle::medium) < (_chatWidth - 10)) { lineBuffer.assign(_chatCurrentLine.c_str(), _chatTextInputSession->SelectionStart); - int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::Medium); + int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::medium); int32_t caretY = screenCoords.y + 14; Rectangle::fill(rt, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PaletteIndex::pi56); @@ -292,8 +293,8 @@ static int32_t ChatHistoryDrawString(RenderTarget& rt, const char* text, const S { int32_t numLines; u8string wrappedString; - GfxWrapString(FormatString("{OUTLINE}{WHITE}{STRING}", text), width, FontStyle::Medium, &wrappedString, &numLines); - auto lineHeight = FontGetLineHeight(FontStyle::Medium); + GfxWrapString(FormatString("{OUTLINE}{WHITE}{STRING}", text), width, FontStyle::medium, &wrappedString, &numLines); + auto lineHeight = FontGetLineHeight(FontStyle::medium); int32_t expectedY = screenCoords.y - (numLines * lineHeight); if (expectedY < 50) @@ -317,7 +318,7 @@ static int32_t ChatHistoryDrawString(RenderTarget& rt, const char* text, const S int32_t ChatStringWrappedGetHeight(u8string_view args, int32_t width) { int32_t numLines; - GfxWrapString(FormatStringID(STR_STRING, args), width, FontStyle::Medium, nullptr, &numLines); - const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + GfxWrapString(FormatStringID(STR_STRING, args), width, FontStyle::medium, nullptr, &numLines); + const int32_t lineHeight = FontGetLineHeight(FontStyle::medium); return lineHeight * (numLines + 1); } diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index 7079b5df47..f520e435c6 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -14,6 +14,11 @@ #include +namespace OpenRCT2 +{ + struct ColourWithFlags; +} + constexpr int8_t kChatHistorySize = 10; constexpr int16_t kChatInputSize = 1024; constexpr uint8_t kChatMaxMessageLength = 200; @@ -38,7 +43,7 @@ void ChatToggle(); void ChatInit(); void ChatUpdate(); -void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColour); +void ChatDraw(RenderTarget& rt, OpenRCT2::ColourWithFlags chatBackgroundColour); void ChatAddHistory(std::string_view s); void ChatInput(ChatInput input); diff --git a/src/openrct2/interface/Colour.cpp b/src/openrct2/interface/Colour.cpp index 27a5b93d6d..ad818b3dc2 100644 --- a/src/openrct2/interface/Colour.cpp +++ b/src/openrct2/interface/Colour.cpp @@ -20,10 +20,6 @@ using namespace OpenRCT2::Drawing; ColourShadeMap ColourMapA[COLOUR_COUNT] = {}; -static constexpr uint8_t kLegacyColourMaskBase = 0x1F; -static constexpr uint8_t kLegacyColourFlagOutline = (1 << 5); -static constexpr uint8_t kLegacyColourFlagInset = (1 << 6); - enum { INDEX_COLOUR_0 = 243, @@ -210,44 +206,3 @@ BlendColourMapType* GetBlendColourMap() return nullptr; } #endif - -bool ColourWithFlags::hasFlag(ColourFlag flag) const -{ - return flags & EnumToFlag(flag); -} - -void ColourWithFlags::setFlag(ColourFlag flag, bool on) -{ - if (on) - flags |= EnumToFlag(flag); - else - flags &= ~EnumToFlag(flag); -} - -ColourWithFlags ColourWithFlags::withFlag(ColourFlag flag, bool on) const -{ - struct ColourWithFlags result = *this; - result.setFlag(flag, on); - return result; -} - -ColourWithFlags ColourWithFlags::fromLegacy(uint8_t legacy) -{ - ColourWithFlags result{}; - result.colour = legacy & kLegacyColourMaskBase; - if (legacy & kLegacyColourFlagTranslucent) - result.flags |= EnumToFlag(ColourFlag::translucent); - if (legacy & kLegacyColourFlagInset) - result.flags |= EnumToFlag(ColourFlag::inset); - if (legacy & kLegacyColourFlagOutline) - result.flags |= EnumToFlag(ColourFlag::withOutline); - - return result; -} - -ColourWithFlags& ColourWithFlags::operator=(colour_t rhs) -{ - colour = rhs; - flags = 0; - return *this; -} diff --git a/src/openrct2/interface/Colour.h b/src/openrct2/interface/Colour.h index 4dedb71547..9d1523964b 100644 --- a/src/openrct2/interface/Colour.h +++ b/src/openrct2/interface/Colour.h @@ -210,34 +210,9 @@ constexpr uint8_t kPaletteLengthAnimated = 16; constexpr uint8_t kColourNumOriginal = 32; constexpr uint8_t kColourNumNormal = 54; -static constexpr uint8_t kLegacyColourFlagTranslucent = (1 << 7); - constexpr colour_t kTextColour254 = 254; constexpr colour_t kTextColour255 = 255; -enum class ColourFlag : uint8_t -{ - translucent, - inset, - withOutline, -}; - -struct ColourWithFlags -{ - colour_t colour{}; - uint8_t flags{}; - - bool hasFlag(ColourFlag flag) const; - - void setFlag(ColourFlag flag, bool on); - - ColourWithFlags withFlag(ColourFlag flag, bool on) const; - - static ColourWithFlags fromLegacy(uint8_t legacy); - - ColourWithFlags& operator=(colour_t rhs); -}; - struct ColourShadeMap { PaletteIndex colour_0; diff --git a/src/openrct2/interface/ColourWithFlags.cpp b/src/openrct2/interface/ColourWithFlags.cpp new file mode 100644 index 0000000000..8ebd645551 --- /dev/null +++ b/src/openrct2/interface/ColourWithFlags.cpp @@ -0,0 +1,45 @@ +/***************************************************************************** + * 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. + *****************************************************************************/ + +#include "ColourWithFlags.h" + +namespace OpenRCT2 +{ + static constexpr uint8_t kLegacyColourMaskBase = 0x1F; + static constexpr uint8_t kLegacyColourFlagOutline = (1 << 5); + static constexpr uint8_t kLegacyColourFlagInset = (1 << 6); + + ColourWithFlags ColourWithFlags::withFlag(ColourFlag flag, bool on) const + { + struct ColourWithFlags result = *this; + result.flags.set(flag, on); + return result; + } + + ColourWithFlags ColourWithFlags::fromLegacy(uint8_t legacy) + { + ColourWithFlags result{}; + result.colour = legacy & kLegacyColourMaskBase; + if (legacy & kLegacyColourFlagTranslucent) + result.flags.set(ColourFlag::translucent); + if (legacy & kLegacyColourFlagInset) + result.flags.set(ColourFlag::inset); + if (legacy & kLegacyColourFlagOutline) + result.flags.set(ColourFlag::withOutline); + + return result; + } + + ColourWithFlags& ColourWithFlags::operator=(colour_t rhs) + { + colour = rhs; + flags = {}; + return *this; + } +} // namespace OpenRCT2 diff --git a/src/openrct2/interface/ColourWithFlags.h b/src/openrct2/interface/ColourWithFlags.h new file mode 100644 index 0000000000..31301fd781 --- /dev/null +++ b/src/openrct2/interface/ColourWithFlags.h @@ -0,0 +1,41 @@ +/***************************************************************************** + * 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. + *****************************************************************************/ + +#pragma once + +#include "../core/FlagHolder.hpp" + +#include + +using colour_t = uint8_t; + +namespace OpenRCT2 +{ + constexpr uint8_t kLegacyColourFlagTranslucent = (1 << 7); + + enum class ColourFlag : uint8_t + { + translucent, + inset, + withOutline, + }; + using ColourFlags = FlagHolder; + + struct ColourWithFlags + { + colour_t colour{}; + ColourFlags flags{}; + + ColourWithFlags withFlag(ColourFlag flag, bool on) const; + + static ColourWithFlags fromLegacy(uint8_t legacy); + + ColourWithFlags& operator=(colour_t rhs); + }; +} // namespace OpenRCT2 diff --git a/src/openrct2/interface/Fonts.cpp b/src/openrct2/interface/Fonts.cpp index 54185412f8..f4f3873121 100644 --- a/src/openrct2/interface/Fonts.cpp +++ b/src/openrct2/interface/Fonts.cpp @@ -193,7 +193,7 @@ void TryLoadFonts(LocalisationService& localisationService) return; } - TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)]; + TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::small)]; LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); } @@ -208,7 +208,7 @@ void TryLoadFonts(LocalisationService& localisationService) return; } - TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)]; + TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::small)]; LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); } diff --git a/src/openrct2/interface/Widget.h b/src/openrct2/interface/Widget.h index a95da188fe..f8fb57cab7 100644 --- a/src/openrct2/interface/Widget.h +++ b/src/openrct2/interface/Widget.h @@ -102,7 +102,7 @@ namespace OpenRCT2 int16_t width() const { - return right - left; + return right - left + 1; } int16_t height() const @@ -112,7 +112,7 @@ namespace OpenRCT2 int16_t midX() const { - return (left + right) / 2; + return left + (width() / 2); } int16_t midY() const diff --git a/src/openrct2/interface/WindowBase.cpp b/src/openrct2/interface/WindowBase.cpp index c2642acede..473dfdbf4d 100644 --- a/src/openrct2/interface/WindowBase.cpp +++ b/src/openrct2/interface/WindowBase.cpp @@ -93,7 +93,7 @@ namespace OpenRCT2 auto& closeButton = widgets[2]; if (closeButton.type == WidgetType::closeBox || closeButton.type == WidgetType::empty) { - bool translucent = colours[closeButton.colour].hasFlag(ColourFlag::translucent); + bool translucent = colours[closeButton.colour].flags.has(ColourFlag::translucent); repositionCloseButton(closeButton, width, translucent); } diff --git a/src/openrct2/interface/WindowBase.h b/src/openrct2/interface/WindowBase.h index 4ea067b3a8..40ca5aab6a 100644 --- a/src/openrct2/interface/WindowBase.h +++ b/src/openrct2/interface/WindowBase.h @@ -11,6 +11,7 @@ #include "../localisation/Formatter.h" #include "Colour.h" +#include "ColourWithFlags.h" #include "ScrollArea.h" #include "Window.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index d7a817f213..cdc55f28bd 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -244,6 +244,7 @@ + @@ -285,6 +286,7 @@ + @@ -862,6 +864,7 @@ + diff --git a/src/openrct2/localisation/Formatting.cpp b/src/openrct2/localisation/Formatting.cpp index db1948189a..12b239b075 100644 --- a/src/openrct2/localisation/Formatting.cpp +++ b/src/openrct2/localisation/Formatting.cpp @@ -419,7 +419,7 @@ namespace OpenRCT2 // Currency symbol auto symbol = currencyDesc->symbol_unicode; auto affix = currencyDesc->affix_unicode; - if (!FontSupportsString(symbol, FontStyle::Medium)) + if (!FontSupportsString(symbol, FontStyle::medium)) { symbol = currencyDesc->symbol_ascii; affix = currencyDesc->affix_ascii; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 9e3f27a495..69b9f42790 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -47,7 +47,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -constexpr uint8_t kStreamVersion = 0; +constexpr uint8_t kStreamVersion = 4; const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion); diff --git a/src/openrct2/network/NetworkKey.h b/src/openrct2/network/NetworkKey.h index 3e329882c7..f46224bce4 100644 --- a/src/openrct2/network/NetworkKey.h +++ b/src/openrct2/network/NetworkKey.h @@ -11,6 +11,7 @@ #ifndef DISABLE_NETWORK + #include #include #include #include diff --git a/src/openrct2/network/NetworkServerAdvertiser.h b/src/openrct2/network/NetworkServerAdvertiser.h index 7738df9b34..1b48717e61 100644 --- a/src/openrct2/network/NetworkServerAdvertiser.h +++ b/src/openrct2/network/NetworkServerAdvertiser.h @@ -9,6 +9,7 @@ #pragma once +#include #include namespace OpenRCT2::Network diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index 9c9e108180..73e2447cd7 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -26,6 +26,9 @@ #ifdef _WIN32 #pragma comment(lib, "Ws2_32.lib") + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif // winsock2 must be included before windows.h #include #include diff --git a/src/openrct2/object/ClimateObject.cpp b/src/openrct2/object/ClimateObject.cpp index a241e0820c..7e9ff423a5 100644 --- a/src/openrct2/object/ClimateObject.cpp +++ b/src/openrct2/object/ClimateObject.cpp @@ -68,7 +68,7 @@ namespace OpenRCT2 ft.Add(dist[i] * 100 / totalSize); DrawTextEllipsised( rt, coords + ScreenCoordsXY{ 12, 22 }, 35, STR_CLIMATE_WEATHER_PERCENT, ft, - { FontStyle::Small, TextAlignment::CENTRE }); + { FontStyle::small, TextAlignment::centre }); } } diff --git a/src/openrct2/object/ImageTable.cpp b/src/openrct2/object/ImageTable.cpp index f7f829fd51..dd3a275816 100644 --- a/src/openrct2/object/ImageTable.cpp +++ b/src/openrct2/object/ImageTable.cpp @@ -298,7 +298,7 @@ namespace OpenRCT2 else { auto objectPath = FindLegacyObject(name); - auto tmp = ObjectFactory::CreateObjectFromLegacyFile(objectPath.c_str(), !gOpenRCT2NoGraphics); + auto tmp = ObjectFactory::CreateObjectFromLegacyFile(objectPath.c_str(), context->ShouldLoadImages()); auto inserted = _objDataCache.insert({ name, std::move(tmp) }); obj = inserted.first->second.get(); } diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index 263cdcb3e7..5d90c86cbf 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -94,7 +94,7 @@ namespace OpenRCT2 if (_hasPreview) GfxDrawSprite(rt, ImageId(_previewImageId), { 0, 0 }); else - DrawTextBasic(rt, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::centre }); } bool MusicObject::HasPreview() const diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index 714d1290cc..d89f4ab9bf 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -165,7 +165,7 @@ namespace OpenRCT2 return objectList; } - std::unique_ptr LoadTempObject(std::string_view id) override + std::unique_ptr LoadTempObject(std::string_view id, bool loadImages) override { const ObjectRepositoryItem* ori = _objectRepository.FindObject(id); if (ori == nullptr) @@ -174,7 +174,7 @@ namespace OpenRCT2 return nullptr; } - auto object = _objectRepository.LoadObject(ori); + auto object = _objectRepository.LoadObject(ori, loadImages); return object; } diff --git a/src/openrct2/object/ObjectManager.h b/src/openrct2/object/ObjectManager.h index ebd128a314..947f1b7d26 100644 --- a/src/openrct2/object/ObjectManager.h +++ b/src/openrct2/object/ObjectManager.h @@ -39,7 +39,7 @@ namespace OpenRCT2 virtual ObjectEntryIndex GetLoadedObjectEntryIndex(const Object* object) = 0; virtual ObjectList GetLoadedObjects() = 0; - virtual std::unique_ptr LoadTempObject(std::string_view identifier) = 0; + virtual std::unique_ptr LoadTempObject(std::string_view identifier, bool loadImages) = 0; virtual Object* LoadObject(std::string_view identifier) = 0; virtual Object* LoadObject(const RCTObjectEntry* entry) = 0; virtual Object* LoadObject(const ObjectEntryDescriptor& descriptor) = 0; diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 8bcf1e6ac4..27c1b89ca1 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -253,10 +253,15 @@ namespace OpenRCT2 } std::unique_ptr LoadObject(const ObjectRepositoryItem* ori) override + { + return LoadObject(ori, !gOpenRCT2NoGraphics); + } + + std::unique_ptr LoadObject(const ObjectRepositoryItem* ori, bool loadImages) override { Guard::ArgumentNotNull(ori, GUARD_LINE); - return ObjectFactory::CreateObjectFromFile(ori->Path, !gOpenRCT2NoGraphics); + return ObjectFactory::CreateObjectFromFile(ori->Path, loadImages); } void RegisterLoadedObject(const ObjectRepositoryItem* ori, std::unique_ptr&& object) override @@ -662,14 +667,14 @@ namespace OpenRCT2 } } - std::unique_ptr ObjectRepositoryLoadObject(const RCTObjectEntry* objectEntry) + std::unique_ptr ObjectRepositoryLoadObject(const RCTObjectEntry* objectEntry, bool loadImages) { std::unique_ptr object; auto& objRepository = GetContext()->GetObjectRepository(); const ObjectRepositoryItem* ori = objRepository.FindObject(objectEntry); if (ori != nullptr) { - object = objRepository.LoadObject(ori); + object = objRepository.LoadObject(ori, loadImages); if (object != nullptr) { object->Load(); diff --git a/src/openrct2/object/ObjectRepository.h b/src/openrct2/object/ObjectRepository.h index 39e4dd9421..a9b951f0cf 100644 --- a/src/openrct2/object/ObjectRepository.h +++ b/src/openrct2/object/ObjectRepository.h @@ -89,6 +89,7 @@ namespace OpenRCT2 [[nodiscard]] virtual const ObjectRepositoryItem* FindObject(const ObjectEntryDescriptor& oed) const = 0; [[nodiscard]] virtual std::unique_ptr LoadObject(const ObjectRepositoryItem* ori) = 0; + [[nodiscard]] virtual std::unique_ptr LoadObject(const ObjectRepositoryItem* ori, bool loadImages) = 0; virtual void RegisterLoadedObject(const ObjectRepositoryItem* ori, std::unique_ptr&& object) = 0; virtual void UnregisterLoadedObject(const ObjectRepositoryItem* ori, Object* object) = 0; @@ -108,5 +109,5 @@ namespace OpenRCT2 [[nodiscard]] const ObjectRepositoryItem* ObjectRepositoryGetItems(); [[nodiscard]] const ObjectRepositoryItem* ObjectRepositoryFindObjectByEntry(const RCTObjectEntry* entry); [[nodiscard]] const ObjectRepositoryItem* ObjectRepositoryFindObjectByName(const char* name); - [[nodiscard]] std::unique_ptr ObjectRepositoryLoadObject(const RCTObjectEntry* objectEntry); + [[nodiscard]] std::unique_ptr ObjectRepositoryLoadObject(const RCTObjectEntry* objectEntry, bool loadImages); } // namespace OpenRCT2 diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 3c71d206ba..5294198677 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -157,6 +157,8 @@ namespace OpenRCT2 void RideObject::ReadLegacy(IReadObjectContext* context, IStream* stream) { + _shouldLoadImages = context->ShouldLoadImages(); + stream->Seek(8, STREAM_SEEK_CURRENT); _legacyType.flags = stream->ReadValue(); for (auto& rideType : _legacyType.ride_type) @@ -342,7 +344,7 @@ namespace OpenRCT2 num_images *= 2; } - if (!gOpenRCT2NoGraphics) + if (_shouldLoadImages) { CarEntrySetImageMaxSizes(carEntry, num_images); } @@ -545,6 +547,7 @@ namespace OpenRCT2 void RideObject::ReadJson(IReadObjectContext* context, json_t& root) { + _shouldLoadImages = context->ShouldLoadImages(); Guard::Assert(root.is_object(), "RideObject::ReadJson expects parameter root to be object"); json_t properties = root["properties"]; diff --git a/src/openrct2/object/RideObject.h b/src/openrct2/object/RideObject.h index d719bfabc4..ea2833de28 100644 --- a/src/openrct2/object/RideObject.h +++ b/src/openrct2/object/RideObject.h @@ -28,6 +28,7 @@ namespace OpenRCT2 VehicleColourPresetList _presetColours = {}; std::vector _peepLoadingPositions[OpenRCT2::RCT2::ObjectLimits::kMaxCarTypesPerRideEntry]; std::vector> _peepLoadingWaypoints[OpenRCT2::RCT2::ObjectLimits::kMaxCarTypesPerRideEntry]; + bool _shouldLoadImages = false; public: static constexpr ObjectType kObjectType = ObjectType::ride; diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index dfe0998ac3..cd2cbcd4ee 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -60,7 +60,7 @@ namespace OpenRCT2 { // Write (no image) auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; - DrawTextBasic(rt, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::centre }); } void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, json_t& root) diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 8c5fb8b63c..7301610af1 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -1098,6 +1098,6 @@ void PaintDrawMoneyStructs(RenderTarget& rt, PaintStringStruct* ps) GfxDrawStringWithYOffsets( rt, buffer, { COLOUR_BLACK }, ps->ScreenPos, reinterpret_cast(ps->y_offsets), forceSpriteFont, - FontStyle::Medium); + FontStyle::medium); } while ((ps = ps->NextEntry) != nullptr); } diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 6ab1efbc38..89c102172a 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -88,7 +88,7 @@ void Painter::PaintReplayNotice(RenderTarget& rt, const char* text) char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{OUTLINE}{RED}{STRING}", text); - auto stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium); + auto stringWidth = GfxGetStringWidth(buffer, FontStyle::medium); screenCoords.x = screenCoords.x - stringWidth; if (((getGameState().currentTicks >> 1) & 0xF) > 4) @@ -116,7 +116,7 @@ void Painter::PaintFPS(RenderTarget& rt) char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{OUTLINE}{WHITE}{INT32}", _currentFPS); - const int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium); + const int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::medium); // Figure out where counter should be rendered ScreenCoordsXY screenCoords(_uiContext.GetWidth() / 2, 2); diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 3df3fa28ed..bf72fa6ffa 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -138,7 +138,8 @@ void VirtualFloorInvalidate(const bool alwaysInvalidate) } // Do not invalidate new region if floor hasn't moved. - if (min_position == _virtualFloorLastMinPos && _virtualFloorLastMinPos.z == _virtualFloorHeight) + if (min_position == _virtualFloorLastMinPos && max_position == _virtualFloorLastMaxPos + && _virtualFloorLastMinPos.z == _virtualFloorHeight) { return; } diff --git a/src/openrct2/paint/tile_element/Paint.Banner.cpp b/src/openrct2/paint/tile_element/Paint.Banner.cpp index 5a54a0a035..91550fa518 100644 --- a/src/openrct2/paint/tile_element/Paint.Banner.cpp +++ b/src/openrct2/paint/tile_element/Paint.Banner.cpp @@ -67,7 +67,7 @@ static void PaintBannerScrollingText( OpenRCT2::FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK); PaintAddImageAsChild(session, imageId, { 0, 0, height + 22 }, { bbOffset, { 1, 1, 21 } }); diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index 2ffd312361..ca40e96212 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -75,7 +75,7 @@ static void PaintRideEntranceExitScrollingText( { FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; PaintAddImageAsChild( @@ -257,7 +257,7 @@ static void PaintParkEntranceScrollingText( FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (gameState.currentTicks / 2) % stringWidth : 0; auto imageIndex = ScrollingTextSetup( session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode + direction / 2, COLOUR_BLACK); diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index a29cb8ab7d..42b535f6d5 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -327,7 +327,7 @@ static void PaintLargeSceneryScrollingText( } auto scrollMode = sceneryEntry.scrolling_mode + ((direction + 1) & 3); - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollMode, textPaletteIndex); PaintAddImageAsChild(session, imageId, { 0, 0, height + 25 }, { bbOffset, { 1, 1, 21 } }); diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 072200084d..d217b98153 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -175,7 +175,7 @@ static void PathPaintQueueBanner( FormatStringLegacy(bannerBuffer, sizeof(bannerBuffer), STR_BANNER_TEXT_FORMAT, ft.Data()); } - uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::Tiny); + uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::tiny); uint16_t scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; PaintAddImageAsChild( diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index a1fc5dd449..c9d96ddaad 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -184,7 +184,7 @@ static void PaintWallScrollingText( OpenRCT2::FormatStringLegacy(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(signString, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(signString, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollingMode, textPaletteIndex); PaintAddImageAsChild(session, imageId, { 0, 0, height + 8 }, { boundsOffset, { 1, 1, 13 } }); diff --git a/src/openrct2/paint/track/thrill/GoKarts.cpp b/src/openrct2/paint/track/thrill/GoKarts.cpp index 23912c60d7..3c736db264 100644 --- a/src/openrct2/paint/track/thrill/GoKarts.cpp +++ b/src/openrct2/paint/track/thrill/GoKarts.cpp @@ -1892,7 +1892,7 @@ static void TrackUp60ToFlatLongBase( } else if (trackSequence == 3 && (direction == 1 || direction == 2)) { - PaintUtilPushTunnelRotated(session, direction, height + 8, kTunnelGroup, TunnelSubType::Flat); + PaintUtilPushTunnelRotated(session, direction, height + 8, kTunnelGroup, TunnelSubType::FlatTo25Deg); } PaintUtilSetSegmentSupportHeight(session, kSegmentsAll, 0xFFFF, 0); static constexpr std::array generalSupportHeights = { 80, 80, 56, 40 }; diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 8291a76bb5..20b408e76f 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -58,7 +58,7 @@ static const wchar_t* _wszArchitecture = WSZ(OPENRCT2_ARCHITECTURE); static std::map _uploadFiles; static std::mutex _uploadFilesMutex; - #define BACKTRACE_TOKEN "da613916de2ddb54c7bded715421516fd96e8072d42bd3d72412f7e083eb0e63" + #define BACKTRACE_TOKEN "08f57d3bbdcf5287883670b0f6d10b6d3f8b776659ea762378b3bfdde5d99216" using namespace OpenRCT2; diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index 47e835a15f..23605cc3ca 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -13,27 +13,27 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif - #include "../Diagnostic.h" - - #include +// clang-format off #include - - // Then the rest - #include "../Version.h" - #include #include #include #include + // clang-format on #undef GetEnvironmentVariable + #undef small + + #include "Platform.h" #include "../Date.h" + #include "../Diagnostic.h" #include "../OpenRCT2.h" + #include "../Version.h" #include "../core/Path.hpp" #include "../core/String.hpp" #include "../localisation/Language.h" - #include "Platform.h" + #include #include #include #include diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 7e603fd9f0..c0cdf0e9b3 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -271,7 +271,7 @@ namespace OpenRCT2::RCT1 auto& objManager = GetContext()->GetObjectManager(); // Load the one specified - if (auto obj = objManager.LoadTempObject(desc.textObjectId); obj != nullptr) + if (auto obj = objManager.LoadTempObject(desc.textObjectId, false); obj != nullptr) { auto& textObject = reinterpret_cast(*obj); name = textObject.GetScenarioName(); @@ -2422,7 +2422,7 @@ namespace OpenRCT2::RCT1 { auto& objManager = GetContext()->GetObjectManager(); - if (auto obj = objManager.LoadTempObject(desc.textObjectId); obj != nullptr) + if (auto obj = objManager.LoadTempObject(desc.textObjectId, false); obj != nullptr) { auto& textObject = reinterpret_cast(*obj); name = textObject.GetScenarioName(); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 5bb9ee2961..6a9231ec8e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -272,7 +272,7 @@ namespace OpenRCT2::RCT2 { auto& objManager = GetContext()->GetObjectManager(); - if (auto obj = objManager.LoadTempObject(desc.textObjectId); obj != nullptr) + if (auto obj = objManager.LoadTempObject(desc.textObjectId, false); obj != nullptr) { auto& textObject = reinterpret_cast(*obj); dst->Name = textObject.GetScenarioName(); diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index f5742fb2c4..9b8ea4b284 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -220,7 +220,7 @@ namespace OpenRCT2::RCT2 if (RCT2RideTypeNeedsConversion(td->trackAndVehicle.rtdIndex)) { std::scoped_lock lock(_objectLookupMutex); - auto rawObject = ObjectRepositoryLoadObject(&td->trackAndVehicle.vehicleObject.Entry); + auto rawObject = ObjectRepositoryLoadObject(&td->trackAndVehicle.vehicleObject.Entry, false); if (rawObject != nullptr) { const auto& rideEntry = static_cast(rawObject.get())->GetEntry(); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index d344c755b7..0063e017d1 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -4347,7 +4347,7 @@ int32_t RideGetRandomColourPresetIndex(ride_type_t rideType) * * Based on rct2: 0x006B4776 */ -void Ride::setColourPreset(uint8_t index) +void Ride::setColourPreset(uint8_t trackColourPreset, uint8_t vehicleColourPreset) { const TrackColourPresetList* colourPresets = &getRideTypeDescriptor().ColourPresets; TrackColour colours = { COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK }; @@ -4357,13 +4357,16 @@ void Ride::setColourPreset(uint8_t index) const auto* rideEntry = GetRideEntryByIndex(subtype); if (rideEntry != nullptr && rideEntry->vehicle_preset_list->count > 0) { - auto list = rideEntry->vehicle_preset_list->list[0]; - colours = { list.Body, list.Trim, list.Tertiary }; + if (vehicleColourPreset < rideEntry->vehicle_preset_list->count) + { + auto list = rideEntry->vehicle_preset_list->list[vehicleColourPreset]; + colours = { list.Body, list.Trim, list.Tertiary }; + } } } - else if (index < colourPresets->count) + else if (trackColourPreset < colourPresets->count) { - colours = colourPresets->list[index]; + colours = colourPresets->list[trackColourPreset]; } for (size_t i = 0; i < std::size(trackColours); i++) { diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 3bcef56b5e..0fbab71c3d 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -327,13 +327,14 @@ public: // in the station array. e.g. if only slot 0 and 2 are in use, index 2 returns 2 instead of 3. StationIndex::UnderlyingType getStationNumber(StationIndex in) const; + void chainQueues() const; + private: void update(); void updateQueueLength(StationIndex stationIndex); ResultWithMessage createVehicles(const CoordsXYE& element, bool isApplying, bool isSimulating); void moveTrainsToBlockBrakes(const CoordsXYZ& firstBlockPosition, OpenRCT2::TrackElement& firstBlock); money64 calculateIncomePerHour() const; - void chainQueues() const; void constructMissingEntranceOrExit() const; ResultWithMessage changeStatusDoStationChecks(StationIndex& stationIndex); @@ -379,7 +380,7 @@ public: RideMode getDefaultMode() const; - void setColourPreset(uint8_t index); + void setColourPreset(uint8_t trackColourPreset, uint8_t vehicleColourPreset); const RideObjectEntry* getRideEntry() const; diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 307f45478c..a4efaadd5e 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1229,12 +1229,6 @@ static GameActions::Result TrackDesignPlaceSceneryElement( return GameActions::Result(); } - if (tds.placeOperation == TrackPlaceOperation::place) - { - FootpathQueueChainReset(); - FootpathRemoveEdgesAt(mapCoord, reinterpret_cast(pathElement)); - } - flags = GAME_COMMAND_FLAG_APPLY; if (tds.placeOperation == TrackPlaceOperation::placeTrackPreview) { @@ -1250,10 +1244,14 @@ static GameActions::Result TrackDesignPlaceSceneryElement( flags |= GAME_COMMAND_FLAG_REPLAY; } - if (tds.placeOperation == TrackPlaceOperation::place) + if (tds.placeOperation == TrackPlaceOperation::placeTrackPreview + || tds.placeOperation == TrackPlaceOperation::place) { - FootpathConnectEdges(mapCoord, reinterpret_cast(pathElement), flags); - FootpathUpdateQueueChains(); + if (!pathElement->IsQueue() || FootpathQueueCountConnections(mapCoord, *pathElement) < 2) + { + FootpathRemoveEdgesAt(mapCoord, reinterpret_cast(pathElement)); + FootpathConnectEdges(mapCoord, reinterpret_cast(pathElement), flags); + } } return GameActions::Result(); @@ -1807,6 +1805,11 @@ static GameActions::Result TrackDesignPlaceVirtual( return sceneryPlaceRes; } + if (tds.placeOperation == TrackPlaceOperation::place || tds.placeOperation == TrackPlaceOperation::placeTrackPreview) + { + ride.chainQueues(); + } + // 0x6D0FE6 if (tds.placeOperation == TrackPlaceOperation::drawOutlines) { @@ -1942,16 +1945,14 @@ static bool TrackDesignPlacePreview( auto mapSize = TileCoordsXY{ gameState.mapSize.x * 16, gameState.mapSize.y * 16 }; _currentTrackPieceDirection = 0; - int32_t z = TrackDesignGetZPlacement( - tds, td, RideGetTemporaryForPreview(), { mapSize.x, mapSize.y, 16, _currentTrackPieceDirection }); + const CoordsXYZD coords = { mapSize.x, mapSize.y, kMinimumLandZ, _currentTrackPieceDirection }; + const int32_t z = kMinimumLandZ + TrackDesignGetZPlacement(tds, td, RideGetTemporaryForPreview(), coords); if (tds.hasScenery) { gameStateData.setFlag(TrackDesignGameStateFlag::HasScenery, true); } - z += 16 - tds.placeSceneryZ; - if (_trackDesignPlaceStateSceneryUnavailable) { placeScenery = false; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 0e4a0b9289..5d482403d3 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -111,275 +111,6 @@ static constexpr OpenRCT2::Audio::SoundId _screamSetSteel[] = { OpenRCT2::Audio::SoundId::scream6, }; -// clang-format off -static constexpr uint8_t kSpaceRingsTimeToSpriteMap[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, - 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, - 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, - 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, - 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 0, - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, - 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, - 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, - 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, - 21, 22, 22, 22, 23, 23, 23, 0, 0, 0, 1, 1, 1, 2, 2, 2, - 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, - 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, - 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, - 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 0, - 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, - 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, - 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, - 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, - 2, 1, 1, 1, 1, 0, 0, 0, 0, 23, 23, 23, 22, 22, 22, 21, - 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, - 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, - 10, 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, - 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, - 0, 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, - 18, 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, - 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, - 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, - 2, 2, 2, 1, 1, 1, 0, 0, 0, 23, 23, 23, 22, 22, 22, 21, - 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, - 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, - 10, 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, - 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, - 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, - 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, - 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, - 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, - 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, - 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, - 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, - 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, - 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, - 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, - 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, - 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, - 78, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, - 82, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, - 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 86, 85, - 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, - 82, 82, 82, 82, 82, 81, 81, 81, 81, 80, 80, 80, 80, 79, 79, 79, - 78, 78, 78, 77, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 73, - 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 69, 69, 69, 68, 68, - 68, 67, 67, 67, 66, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, - 62, 62, 62, 61, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 57, - 57, 57, 56, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, - 52, 51, 51, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47, - 46, 46, 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 42, 41, - 41, 41, 40, 40, 40, 39, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, - 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, - 30, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, - 27, 27, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 24, 24, - 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, - 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, - 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, - 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, - 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, - 22, 22, 22, 23, 23, 23, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, - 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, - 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, - 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, - 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 0, 0, - 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, - 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, - 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, - 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, - 22, 22, 22, 23, 23, 23, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, - 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, - 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, - 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, - 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, - 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, - 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, 8, - 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, - 2, 2, 1, 1, 1, 0, 0, 0, 23, 23, 23, 22, 22, 22, 21, 21, - 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, - 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, - 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, - 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, - 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, - 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, - 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, 8, - 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, - 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, - 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, - 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, - 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, - 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, - 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, - 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, - 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, - 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, - 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, - 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, - 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 81, - 81, 81, 81, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 84, 84, 84, - 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, - 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 86, - 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, - 84, 84, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 81, 81, 81, 81, - 80, 80, 80, 80, 79, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 76, - 75, 75, 75, 74, 74, 74, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, - 70, 70, 69, 69, 69, 68, 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, - 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, - 59, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 54, - 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, - 49, 48, 48, 48, 47, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44, - 43, 43, 43, 42, 42, 42, 41, 41, 41, 40, 40, 40, 39, 39, 39, 38, - 38, 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, - 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 28, - 28, 28, 28, 28, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 25, - 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 0, - 255, -}; -// clang-format on - -static constexpr int8_t kSwingingTimeToSpriteMap0[] = { - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, - -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap1[] = { - 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, - 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, - -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap2[] = { - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, - 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, - 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, - -1, -1, -1, -2, -2, -2, -3, -3, -3, -3, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -6, -6, -6, -6, -6, - -6, -6, -6, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -6, - -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -3, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap3[] = { - 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, - 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, - 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, - -1, -2, -2, -3, -3, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -7, -8, -8, -8, -8, - -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, -8, -7, -7, - -7, -7, -7, -7, -6, -6, -6, -6, -6, -5, -5, -5, -5, -4, -4, -4, -3, -3, -2, -2, -1, -1, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap4[] = { - 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, - 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, - -1, -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -5, -6, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -4, -4, - -4, -4, -4, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap5[] = { - 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, - 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, - 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, - 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, - 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, - -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -7, -7, -7, -7, -8, -8, -8, -8, -9, -9, -9, -9, - -10, -10, -10, -10, -11, -11, -11, -11, -12, -12, -12, -12, -13, -13, -13, -13, -13, -13, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -13, -13, -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, - -11, -11, -10, -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -8, -7, -7, -7, -7, -6, -6, -6, -6, -5, -5, - -5, -5, -4, -4, -4, -4, -3, -3, -3, -3, -2, -2, -2, -2, -1, -1, -1, -1, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap6[] = { - 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, - 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, - 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, - 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 23, 23, 23, 22, - 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, - 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, - 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, -1, - -1, -1, -2, -2, -2, -3, -3, -3, -4, -4, -4, -5, -5, -5, -6, -6, -6, -7, -7, -7, -8, -8, -8, - -9, -9, -9, -10, -10, -10, -11, -11, -11, -12, -12, -12, -13, -13, -13, -14, -14, -14, -15, -15, -15, -16, -16, - -16, -17, -17, -17, -18, -18, -18, -19, -19, -19, -20, -20, -20, -21, -21, -21, -22, -22, -22, -23, -23, -23, -23, - -23, -24, -24, -24, -24, -24, -24, -24, -24, -24, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -24, -24, -24, -24, -24, -24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, - -21, -21, -21, -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, - -14, -13, -13, -13, -12, -12, -12, -11, -11, -11, -10, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -7, -6, - -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap7[] = { - 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, - 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, - 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, - 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, - 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, -35, - -35, -35, -34, -34, -34, -33, -33, -33, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, - -28, -27, -27, -27, -26, -26, -26, -25, -25, -25, -24, -24, -24, -23, -23, -23, -22, -22, -22, -21, -21, -21, - -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14, -13, - -13, -13, -12, -12, -12, -11, -11, -11, -10, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -7, -6, -6, - -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap8[] = { - 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, - 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 31, - 31, 31, 31, 31, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, - 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap9[] = { - 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, - 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 31, - 31, 31, 31, 31, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, - 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap10[] = { - 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, - 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, - 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, - 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 31, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 28, - 28, 28, 28, 27, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24, 24, 23, 23, 23, 23, 22, 22, 22, 22, 21, 21, 21, - 21, 20, 20, 20, 20, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, - 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, - 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 0, 0, -128, -}; -static constexpr int8_t kSwingingTimeToSpriteMap11[] = { - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, - 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, - 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, - 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 0, -128, -}; - -/** rct2: 0x0099F9D0 */ -static constexpr const int8_t* SwingingTimeToSpriteMaps[] = { - kSwingingTimeToSpriteMap0, kSwingingTimeToSpriteMap1, kSwingingTimeToSpriteMap2, kSwingingTimeToSpriteMap3, - kSwingingTimeToSpriteMap4, kSwingingTimeToSpriteMap5, kSwingingTimeToSpriteMap6, kSwingingTimeToSpriteMap7, - kSwingingTimeToSpriteMap8, kSwingingTimeToSpriteMap9, kSwingingTimeToSpriteMap10, kSwingingTimeToSpriteMap11, -}; - /** rct2: 0x009A37C4 */ static constexpr CoordsXY kSurroundingTiles[] = { { 0, 0 }, @@ -4021,7 +3752,7 @@ void Vehicle::UpdateSwinging() swingState += 4; } - const int8_t* spriteMap = SwingingTimeToSpriteMaps[swingState]; + const auto spriteMap = kSwingingTimeToSpriteMaps[swingState]; int8_t spriteType = spriteMap[current_time + 1]; // 0x80 indicates that a complete swing has been diff --git a/src/openrct2/ride/VehicleData.cpp b/src/openrct2/ride/VehicleData.cpp index 9fd0a8ae13..929e8226f7 100644 --- a/src/openrct2/ride/VehicleData.cpp +++ b/src/openrct2/ride/VehicleData.cpp @@ -794,4 +794,270 @@ const uint8_t MotionSimulatorTimeToSpriteMap[] = { }; const int32_t MotionSimulatorTimeToSpriteMapCount = static_cast(std::size(MotionSimulatorTimeToSpriteMap)); + +const uint8_t kSpaceRingsTimeToSpriteMap[] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, + 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, + 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, + 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, + 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 0, + 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, + 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, + 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, + 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, + 21, 22, 22, 22, 23, 23, 23, 0, 0, 0, 1, 1, 1, 2, 2, 2, + 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, + 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, + 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, + 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 0, + 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, + 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, + 2, 1, 1, 1, 1, 0, 0, 0, 0, 23, 23, 23, 22, 22, 22, 21, + 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, + 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, + 10, 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, + 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, + 0, 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, + 18, 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, + 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, + 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, + 2, 2, 2, 1, 1, 1, 0, 0, 0, 23, 23, 23, 22, 22, 22, 21, + 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, + 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, + 10, 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, + 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, + 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, + 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, + 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, + 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, + 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, + 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, + 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, + 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, + 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, + 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, + 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, + 78, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, + 82, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, + 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 86, 86, 86, 86, 86, 86, 86, 85, + 85, 85, 85, 85, 85, 84, 84, 84, 84, 84, 84, 83, 83, 83, 83, 83, + 82, 82, 82, 82, 82, 81, 81, 81, 81, 80, 80, 80, 80, 79, 79, 79, + 78, 78, 78, 77, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 73, + 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 69, 69, 69, 68, 68, + 68, 67, 67, 67, 66, 66, 66, 65, 65, 65, 64, 64, 64, 63, 63, 63, + 62, 62, 62, 61, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58, 57, + 57, 57, 56, 56, 56, 55, 55, 55, 54, 54, 54, 53, 53, 53, 52, 52, + 52, 51, 51, 51, 50, 50, 50, 49, 49, 49, 48, 48, 48, 47, 47, 47, + 46, 46, 46, 45, 45, 45, 44, 44, 44, 43, 43, 43, 42, 42, 42, 41, + 41, 41, 40, 40, 40, 39, 39, 39, 38, 38, 38, 37, 37, 37, 36, 36, + 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, + 30, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, + 27, 27, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 24, 24, + 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, + 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, + 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, + 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, + 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, + 22, 22, 22, 23, 23, 23, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, + 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, + 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, + 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, + 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 0, 0, + 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, + 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, + 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, + 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, + 22, 22, 22, 23, 23, 23, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, + 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, + 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, + 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, + 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, + 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, + 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, 8, + 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, + 2, 2, 1, 1, 1, 0, 0, 0, 23, 23, 23, 22, 22, 22, 21, 21, + 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, + 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, + 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, + 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, + 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, + 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, + 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, 8, + 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, + 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, + 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, + 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, + 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, + 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, + 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, + 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, + 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, + 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, + 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, + 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, + 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, + 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 80, 81, + 81, 81, 81, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 84, 84, 84, + 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, + 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 86, + 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 84, 84, 84, 84, + 84, 84, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 81, 81, 81, 81, + 80, 80, 80, 80, 79, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 76, + 75, 75, 75, 74, 74, 74, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, + 70, 70, 69, 69, 69, 68, 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, + 65, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 61, 60, 60, 60, + 59, 59, 59, 58, 58, 58, 57, 57, 57, 56, 56, 56, 55, 55, 55, 54, + 54, 54, 53, 53, 53, 52, 52, 52, 51, 51, 51, 50, 50, 50, 49, 49, + 49, 48, 48, 48, 47, 47, 47, 46, 46, 46, 45, 45, 45, 44, 44, 44, + 43, 43, 43, 42, 42, 42, 41, 41, 41, 40, 40, 40, 39, 39, 39, 38, + 38, 38, 37, 37, 37, 36, 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, + 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 28, + 28, 28, 28, 28, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 25, + 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 0, + 255, +}; + +static constexpr int8_t kSwingingTimeToSpriteMap0[] = { + 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, + -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap1[] = { + 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, + 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, + -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap2[] = { + 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, + 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, + -1, -1, -1, -2, -2, -2, -3, -3, -3, -3, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -6, -6, -6, -6, -6, + -6, -6, -6, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -6, + -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -3, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap3[] = { + 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, + 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, + 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, + -1, -2, -2, -3, -3, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -7, -8, -8, -8, -8, + -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, -8, -7, -7, + -7, -7, -7, -7, -6, -6, -6, -6, -6, -5, -5, -5, -5, -4, -4, -4, -3, -3, -2, -2, -1, -1, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap4[] = { + 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, + 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, + -1, -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -5, -6, -6, + -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, + -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -4, -4, + -4, -4, -4, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap5[] = { + 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, + 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, + 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, + 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, + 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, + -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -7, -7, -7, -7, -8, -8, -8, -8, -9, -9, -9, -9, + -10, -10, -10, -10, -11, -11, -11, -11, -12, -12, -12, -12, -13, -13, -13, -13, -13, -13, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, + -15, -15, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -13, -13, -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, + -11, -11, -10, -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -8, -7, -7, -7, -7, -6, -6, -6, -6, -5, -5, + -5, -5, -4, -4, -4, -4, -3, -3, -3, -3, -2, -2, -2, -2, -1, -1, -1, -1, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap6[] = { + 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, + 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, + 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, + 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 23, 23, 23, 22, + 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, 15, 15, 15, + 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, + 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, -1, + -1, -1, -2, -2, -2, -3, -3, -3, -4, -4, -4, -5, -5, -5, -6, -6, -6, -7, -7, -7, -8, -8, -8, + -9, -9, -9, -10, -10, -10, -11, -11, -11, -12, -12, -12, -13, -13, -13, -14, -14, -14, -15, -15, -15, -16, -16, + -16, -17, -17, -17, -18, -18, -18, -19, -19, -19, -20, -20, -20, -21, -21, -21, -22, -22, -22, -23, -23, -23, -23, + -23, -24, -24, -24, -24, -24, -24, -24, -24, -24, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -24, -24, -24, -24, -24, -24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, + -21, -21, -21, -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, + -14, -13, -13, -13, -12, -12, -12, -11, -11, -11, -10, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -7, -6, + -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap7[] = { + 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, + 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, + 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, + 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, + 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, -35, + -35, -35, -34, -34, -34, -33, -33, -33, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, + -28, -27, -27, -27, -26, -26, -26, -25, -25, -25, -24, -24, -24, -23, -23, -23, -22, -22, -22, -21, -21, -21, + -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14, -13, + -13, -13, -12, -12, -12, -11, -11, -11, -10, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -7, -6, -6, + -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap8[] = { + 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, + 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 31, + 31, 31, 31, 31, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, + 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap9[] = { + 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, + 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 31, + 31, 31, 31, 31, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, + 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap10[] = { + 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, + 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, + 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, + 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 31, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 28, + 28, 28, 28, 27, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24, 24, 23, 23, 23, 23, 22, 22, 22, 22, 21, 21, 21, + 21, 20, 20, 20, 20, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, + 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, + 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 0, 0, -128, +}; +static constexpr int8_t kSwingingTimeToSpriteMap11[] = { + 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, + 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, + 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, + 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 0, -128, +}; + +const int8_t* kSwingingTimeToSpriteMaps[] = { + kSwingingTimeToSpriteMap0, kSwingingTimeToSpriteMap1, kSwingingTimeToSpriteMap2, kSwingingTimeToSpriteMap3, + kSwingingTimeToSpriteMap4, kSwingingTimeToSpriteMap5, kSwingingTimeToSpriteMap6, kSwingingTimeToSpriteMap7, + kSwingingTimeToSpriteMap8, kSwingingTimeToSpriteMap9, kSwingingTimeToSpriteMap10, kSwingingTimeToSpriteMap11, +}; // clang-format on diff --git a/src/openrct2/ride/VehicleData.h b/src/openrct2/ride/VehicleData.h index 5885c01efa..859e4c039c 100644 --- a/src/openrct2/ride/VehicleData.h +++ b/src/openrct2/ride/VehicleData.h @@ -25,3 +25,8 @@ extern const TopSpinTimeToSpriteMap* kTopSpinTimeToSpriteMaps[]; extern const uint8_t MotionSimulatorTimeToSpriteMap[]; extern const int32_t MotionSimulatorTimeToSpriteMapCount; + +extern const uint8_t kSpaceRingsTimeToSpriteMap[]; + +/** rct2: 0x0099F9D0 */ +extern const int8_t* kSwingingTimeToSpriteMaps[]; diff --git a/src/openrct2/scenes/title/TitleScene.cpp b/src/openrct2/scenes/title/TitleScene.cpp index 9ab24763d2..239fae6bc0 100644 --- a/src/openrct2/scenes/title/TitleScene.cpp +++ b/src/openrct2/scenes/title/TitleScene.cpp @@ -141,7 +141,7 @@ void TitleScene::Tick() ScreenshotCheck(); TitleHandleKeyboardInput(); - if (GameIsNotPaused()) + if (!gOpenRCT2Headless && GameIsNotPaused()) { TryLoadSequence(); _sequencePlayer->Update(); @@ -205,6 +205,10 @@ void TitleScene::CreateWindows() void TitleScene::TitleInitialise() { + if (gOpenRCT2Headless) + { + return; + } if (_sequencePlayer == nullptr) { _sequencePlayer = GetContext().GetUiContext().GetTitleSequencePlayer(); @@ -285,7 +289,7 @@ void TitleScene::TitleInitialise() bool TitleScene::TryLoadSequence(bool loadPreview) { - if (_loadedTitleSequenceId != _currentSequence || loadPreview) + if (!gOpenRCT2Headless && (_loadedTitleSequenceId != _currentSequence || loadPreview)) { if (_sequencePlayer == nullptr) { diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 43f754812d..57a5bdf1e3 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -955,6 +955,51 @@ void FootpathUpdateQueueChains() } } +int32_t FootpathQueueCountConnections(const CoordsXY& position, const PathElement& pathElement) +{ + int32_t connectionCount = 0; + for (const Direction direction : kAllDirections) + { + const uint8_t edge = 1 << direction; + if (pathElement.GetEdges() & edge) + { + const CoordsXY adjacentPathPosition = position + CoordsDirectionDelta[direction]; + const int32_t z = pathElement.GetBaseZ(); + const TileElement* tileElement = FootpathGetElement({ adjacentPathPosition, z, z + kLandHeightStep }, direction); + + if (tileElement == nullptr) + { + tileElement = FootpathGetElement({ adjacentPathPosition, z - kLandHeightStep, z }, direction); + + if (tileElement == nullptr) + { + const EntranceElement* entrance = MapGetRideEntranceElementAt(CoordsXYZ{ adjacentPathPosition, z }, true); + if (entrance == nullptr) + { + entrance = MapGetRideEntranceElementAt(CoordsXYZ{ adjacentPathPosition, z + kLandHeightStep }, true); + if (entrance == nullptr) + continue; + } + + if (entrance_has_direction(*entrance, direction + entrance->GetDirection())) + { + connectionCount++; + } + continue; + } + } + + const PathElement& adjacentPath = *tileElement->AsPath(); + + if (adjacentPath.GetEdges() & Numerics::rol4(edge, 2)) + { + connectionCount++; + } + } + } + return connectionCount; +} + /** * * rct2: 0x0069ADBD diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 9690d468f8..9fa7c8e188 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -189,6 +189,7 @@ const OpenRCT2::FootpathRailingsObject* GetPathRailingsEntry(OpenRCT2::ObjectEnt void FootpathQueueChainReset(); void FootpathQueueChainPush(RideId rideIndex); +int32_t FootpathQueueCountConnections(const CoordsXY& position, const OpenRCT2::PathElement& pathElement); bool FootpathIsZAndDirectionValid(const OpenRCT2::PathElement& tileElement, int32_t currentZ, int32_t currentDirection); FootpathPlacementResult FootpathGetOnTerrainPlacement(const TileCoordsXY& location); diff --git a/test/tests/testdata/ratings/BigMapTest.sv6.txt b/test/tests/testdata/ratings/BigMapTest.sv6.txt index f3f684f653..e11501c474 100644 --- a/test/tests/testdata/ratings/BigMapTest.sv6.txt +++ b/test/tests/testdata/ratings/BigMapTest.sv6.txt @@ -34,7 +34,7 @@ mine_train_rc: (642, 708, 468) looping_rc: (606, 564, 264) stand_up_rc: (536, 943, 644) corkscrew_rc: (613, 830, 365) -lim_launched_rc: (632, 937, 529) +lim_launched_rc: (632, 870, 529) twister_rc: (784, 645, 372) hyper_twister: (737, 620, 344) giga_rc: (851, 545, 305) diff --git a/test/tests/testdata/ratings/EverythingPark.park.txt b/test/tests/testdata/ratings/EverythingPark.park.txt index 4a670df88f..69a86548de 100644 --- a/test/tests/testdata/ratings/EverythingPark.park.txt +++ b/test/tests/testdata/ratings/EverythingPark.park.txt @@ -428,9 +428,9 @@ giga_rc: (460, 1219, 505) maze: (139, 52, 0) submarine_ride: (247, 180, 140) submarine_ride: (247, 180, 140) -lim_launched_rc: (53, 61, 40) -lim_launched_rc: (53, 61, 40) -lim_launched_rc: (53, 61, 40) +lim_launched_rc: (53, 57, 40) +lim_launched_rc: (53, 57, 40) +lim_launched_rc: (53, 57, 40) flying_rc: (31, 282, 473) flying_rc: (31, 282, 473) flying_rc: (31, 282, 473) @@ -475,9 +475,9 @@ maze: (150, 90, 0) maze: (150, 90, 0) maze: (150, 90, 0) corkscrew_rc: (482, 510, 220) -lim_launched_rc: (528, 730, 443) -lim_launched_rc: (532, 727, 436) -lim_launched_rc: (530, 812, 472) +lim_launched_rc: (528, 678, 443) +lim_launched_rc: (532, 675, 436) +lim_launched_rc: (530, 754, 472) miniature_railway: (154, 12, 1) miniature_railway: (154, 12, 1) miniature_railway: (149, 12, 1) diff --git a/test/tests/testdata/ratings/bpb.sv6.txt b/test/tests/testdata/ratings/bpb.sv6.txt index 9910aa43f5..5946f1ee7b 100644 --- a/test/tests/testdata/ratings/bpb.sv6.txt +++ b/test/tests/testdata/ratings/bpb.sv6.txt @@ -96,7 +96,7 @@ mini_rc: (539, 563, 397) spiral_rc: (620, 373, 215) looping_rc: (467, 441, 182) stand_up_rc: (553, 790, 558) -lim_launched_rc: (680, 944, 573) +lim_launched_rc: (680, 876, 573) twister_rc: (778, 769, 425) giga_rc: (624, 359, 200) inverted_rc: (678, 850, 686)