Commit Graph
172 Commits
Author SHA1 Message Date
Duncan a268350615 Fix #15439: Ride viewport is partially grey
The ride viewport does not work the same as other viewports due to the selection of views that it has. After refactoring the focus system to use a more streamlined approach the ride viewport lost its invalidation on resizing. If the ride window was to use the same viewport update code as say the guest window then the viewport focus still ends up incorrect due to it no longer centring the focus. Therefore the best approach was to lose the focus on resize and force a recalculation of it.

Also renamed Focus2 to Focus as Focus2 was meant to just be fill in whilst removing the original focus structs.
2021-09-21 11:06:04 +02:00
Duncan fa57b6aea0 Remove focus union and replace with typed focus (#15426)
* Remove focus union and replace with typed focus

This if for the NSF to allow for CoordsXYZ

* Remove legacy structures

* Rework viewport_create to deduplicate logic

* Simplify yet further

* Apply review comments

* Remove intermediate
2021-09-18 20:34:38 +01:00
Hielke Morsink 4b4b3333d6 Remove unnecessary else blocks 2021-09-16 18:31:12 +02:00
Hielke Morsink 28681eebc0 Merge pull request #15407 from ZehMatt/refactor/optional-use
Make use of std::optional strict
2021-09-14 17:45:18 +02:00
Kane b35fd28c55 Feature #7682: Lock camera to vehicle in main window
Pressing the "Locate" button in the Ride window when selected on a "Vehicle/Train" will now have the main viewport track the vehicle.
2021-09-13 20:44:52 +02:00
ζeh Matt 59a6c34db4 Make use of std::optional strict 2021-09-13 20:02:32 +03:00
Hielke Morsink d42bc9a469 Merge pull request #15383 from Broxzier/refactor/smart-follow-cleanup 2021-09-10 20:13:23 +02:00
Hielke Morsink f966c229c0 Refactor out unnecessary Is<Guest/Staff> checks 2021-09-09 18:44:52 +02:00
Michael Steenbeek 624a32e93b Make Coords isNull/setNull functions TitleCase (#15382) 2021-09-08 20:48:53 -03:00
Hielke Morsink 2b51b91524 Make peep argument const 2021-09-08 22:59:58 +02:00
Hielke Morsink d3263ef6b7 Make smart follow functions easier to follow
Opted for a switch case instead of if-else if-else if-else
Reuse entity - is already checked for null and doesn't change
Remove unnecessary else blocks after if-block that returns
2021-09-08 22:55:08 +02:00
Duncan b2d0b54d13 Fix viewport interaction when zoomed (#15318)
Mistake made when increasing the type size from 16 to 32bit
2021-09-01 06:15:45 +01:00
ζeh Matt 5bf882587a Use constexpr where applicable in Viewport.cpp 2021-08-27 18:24:08 +03:00
ζeh Matt 55add9883f Implement DirectionFlipXAxis 2021-08-24 22:57:13 +02:00
DuncanandTed John 940cab87d3 Map size refactors from NSF (#15112)
* Support large map sizes

* Fix top spin painting

* Fix crooked house

* Increase bb size

* Decrease limit back

* Clang format

* Remove asserts and apply review comments

* Fix rebase mistake

Co-authored-by: Ted John <ted@brambles.org>
2021-08-16 20:51:16 +01:00
duncanspumpkin 98f9f24909 Remove sprite.h includes where possible 2021-05-29 08:54:33 +01:00
Duncan 39fcc5d078 Split up Sprite header (#14764)
* Remove fields from rct_sprite union

* more header fun

* Fix guest include
2021-05-29 06:01:32 +01:00
Ted John 7854d94599 Fix benchmarking 2021-05-03 02:38:42 +01:00
Ted John bba967d62e Start working on benchmark changes 2021-05-02 22:02:09 +01:00
Ted John cb6d471560 Increase paint struct limit by using shared pool 2021-04-27 01:27:49 +01:00
Duncan 977d05ba29 Entity type5: Remove peep assigned type (#14380)
* Remove users of AssignedPeepType

* Remove AssignedPeepType

Field no longer required due to changes to EntityType

* Move enum to the RCT12 header

* Increment network version

* Update replays
2021-03-24 08:54:05 +00:00
Duncan df7a284822 Entity type 2: Remove sprite_identifier (#14334)
* Start changing the underlying type

* Further work

* Complete refactor

* Further cleanup

* Remove pointless check

* Increment network and plugin versions

* Add defaults

* Further defaults

* Fix test paint

* Update replays
2021-03-17 08:04:41 +00:00
Michał Janiszewski 67b61478cf Reduce inclusion of EntityList.h 2021-02-25 10:56:27 +01:00
Ted John 762b6ee816 Refactor viewport interaction flags and add plugin API 2021-02-18 18:10:29 +00:00
Ted John 27013d147a Invalidate viewport when moving without scrolling 2021-02-18 18:10:29 +00:00
ζeh Matt db4841ca45 Avoid copy and allocation for rendering the viewport (#13911) 2021-01-27 07:28:07 +00:00
skdltmxn 7ef4d7762f Refactor to avoid unnecessary copies (#13736)
* Refactor to avoid unnecessary copies

* Fix dangling references
2021-01-11 18:14:15 -03:00
ζeh Matt a6080b7996 Refactor code to dynamically add and remove viewports (#13687) 2021-01-07 19:06:49 +00:00
Dennis Devriendt 3073cca6aa Close #13624: Refactor ViewportInteractionItem to use strong enum (#13657)
* Closes #13624: Refactor ViewportInteractionItem to use strong enum
2020-12-29 15:09:15 -03:00
Łukasz Pękalski 4adf745237 Close #12403: Refactor FILTER_PALETTE_ID to use strong enum (#13273) 2020-12-05 15:13:59 -03:00
Hielke MorsinkandMichael Steenbeek f0c1ea1d37 Split declarations and definitions to improve compile times when editing (#13332)
* Split FileStream declarations and definitions

* Split JobPool declarations and definitions

* Split StringBuilder declarations and definitions

* Split StringReader declarations and definitions

* Split ZoomLevel declarations and definitions

* Fix missing include in FileClassifier.cpp

* Remove pragma once from source files

* Fix missing include in StringBuilder.h

* Update Xcode project

* Fix compilation of tests

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>
2020-11-07 12:42:04 +00:00
ju-pinheiro bb16ca075b Close #12450: Refactor SPRITE_IDENTIFIER to use strong enum 2020-10-27 13:26:27 -03:00
Duncan 214f6992dd Rename to TitleCase and name LastAttachedPS (#13260) 2020-10-22 18:13:54 +01:00
Duncan 250586cb45 Port some OpenLoco helper functions (#13113)
* Port some OpenLoco helper functions

Added a few helper functions from OpenLoco to make viewport code a bit simpler
2020-10-12 22:25:11 -03:00
Bryan DiLaura 7c95f594d3 Close #12413: Refactor VISIBILITY_CACHE to use strong enum (#13136) 2020-10-09 19:12:14 -03:00
Julia Pinheiro 8800c32e52 Close #12404: Refactor DRAWING_ENGINE to use strong enum (#13070) 2020-10-02 22:41:30 -03:00
Łukasz Pękalski d1cd2e08b5 Close #12388, refactor PeepState to use strong enum (#12927)
* Close #12388, refactor:PeepState to use strong enum

* refactor: refactored file PlayTests.cpp

* refactor: change PEEP_STATE_ to PeepState:: and camel case after merging

chore: code reformatting
2020-09-28 15:51:49 -03:00
Ted John a1cd02c61c Disable closer zoom levels for software rendering 2020-08-28 01:29:59 +01:00
Ted John 7f0510e444 Fix sub pixel clip issues with OpenGL 2020-08-28 01:29:59 +01:00
Ted John 2b51eaeaa1 Fix weather gloom when zoomed in 2020-08-28 01:29:59 +01:00
Matt ThomsonandMatt Thomson a8f8f06e2d Fix #12402: Refactor MEASUREMENT_FORMAT to use strong enum (#12642)
* Fix #12402: Refactor MEASUREMENT_FORMAT to use strong enum

* Remove redundant default branches

Co-authored-by: Matt Thomson <matt-thomson@users.noreply.github.com>
2020-08-13 21:51:28 +01:00
Duncan aa11773da3 Fix #12566, #12565, #12562, #12560, #12558: Nullptr deref (#12567)
Mistake made in refactor meant that a nullptr deref took place when the screen coords were outside of the normal play area
2020-08-02 20:13:09 +01:00
Duncan 733bc5a981 Close #12518: Viewport Refactor (#12541)
* Remove viewport pointer from get_map_coordinates_from_pos

* Removed viewport from get_window

* Return a InteractionInfo from get_map_coord...

* Remove viewport_interaction_info struct

* Add Entity union to simplify code

* Name the enum used for viewport interaction

* Simplify functions further by returning the info struct

* Add default switches
2020-08-02 08:32:59 +01:00
Duncan c6e26267a4 Reduce the use of GET_VEHICLE (#12494)
* Start removing GET_VEHICLE macro use

* Further work

* Remove further GET_VEHICLE's

* Further removal of GET_VEHICLE

* Remove the last of GET_VEHICLE

* Fix testpaint

* Fix nullptr deref

* Make review changes

Also swapped in helper functions and used a standard patern for iterating the train cars

* Further simplify loops for train cars
2020-07-31 07:48:27 +01:00
frutiemax af0fc89cf4 Close #12456: Refactor INPUT_STATE to use strong enum (#12484) 2020-07-27 19:51:10 -03:00
Duncan 8a378ad236 Remove uses of GET_PEEP macro and replace with GetEntity (#12467)
* Use TryGetEntity and GetEntity instead of macro

* Use GetEntity for ui guest window

* Remove final GET_PEEP macro uses

* Fix remaining issues
2020-07-26 17:42:02 +01:00
Matt fa2bd4cad6 Refactor PeepType to use strong enum 2020-07-25 11:54:37 +02:00
Aaron van Geffen 7b5087f057 Update copyright year to 2020 2020-07-21 15:04:34 +02:00
frutiemax 31efe32ade Related to #12160: Refactor viewport_coord_to_map_coord using Rotate (#12247) 2020-07-16 06:55:48 +01:00
frutiemaxandduncanspumpkin c8b66dd289 Fix #12257: Fix refactoring of is_sprite_interacted_with_palette_set (#12258)
* Fix #12257: Change type of paint x/y to int32_t

This corrects an issue with integer conversions due to signness.

* Change types to 16bit and correct functions parameters

* Fix test paint.

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-07-14 12:20:53 +01:00