Commit Graph

578 Commits

Author SHA1 Message Date
Matt 2cf4a42cbe
Add rain rendering to OpenGL renderer 2019-07-18 20:54:47 +02:00
Michael Steenbeek 3706581073
Add support for drawing en-dash and multiplication sign (#9570) 2019-07-14 15:58:33 +02:00
Aaron van Geffen cfd863ef12 Prevent making unnecessary copies in certain tile loops (#9549) 2019-07-11 18:43:33 +02:00
ζeh Matt 7c0f04903e Fix crash with truetype fonts and multi threading (#9424) 2019-06-16 17:43:53 +02:00
Ted John f842d8a693 Fix #5103: OpenGL: ride track preview not rendered 2019-05-02 00:07:43 +00:00
Matt 4e264bd45d Use mutex to protect scrolling banner cache from data race 2019-04-02 20:14:50 +02:00
Matt 1153b97ace Use thread_local to protect globals from data race 2019-03-31 17:15:15 +02:00
Matt 37c3809744 Implement partial multicore rendering 2019-03-31 15:50:55 +02:00
ζeh Matt 0b41c0f9a1 Fix #8988: Improve lookups for codepoint offsets 2019-03-30 21:50:49 +01:00
Gymnasiast ff12d5c202 Add Z with caron 2019-03-27 10:06:25 +01:00
Gymnasiast cf65d01ac0 Add U with ring 2019-03-27 10:06:25 +01:00
Gymnasiast ef5472c566 Add S with caron 2019-03-27 10:06:25 +01:00
Gymnasiast fd1f763b83 Add R with caron 2019-03-27 10:06:25 +01:00
Gymnasiast 43d4a20b79 Add N with caron 2019-03-27 10:06:25 +01:00
Aaron van Geffen 2af13904c5 Update copyright notices for 2019. (#8903) 2019-03-17 07:16:15 +00:00
Michał Janiszewski 8a395e3706
Fix misaligned access (#8665)
Platforms like ARM are very sensitive to unaligned access. This change
makes sure the addresses obey the C++ standard and are properly aligned.
2019-02-04 23:15:14 +01:00
Michał Janiszewski 7655ba7746 Make screenshot return path to file 2019-01-31 23:36:41 +01:00
Michał Janiszewski 5b467ffc68
Fix rendering of text shadows with TTF (#8533)
Only render shadow if it is within the bounds of allocated buffer.
This fixes most if not all crashes seen with rendering TTF. The cause of
the problem is rendering of shadows which is done by taking a solid
rendered text and moving it by one pixel to up, left, right and *down*.
In some cases rendering the shadow in the one-down offset will write
past the allocated surface (see
8d9fcb7f98/src/openrct2/drawing/Drawing.String.cpp (L594))
it can easily happen when trying to render a shadowed text (e.g. map
tooltip) on a peep that's just above the bottom of the viewport.
2018-12-28 11:47:08 -08:00
ζeh Matt 7d19a5bc77 Refactor memcpy to std::memcpy and memset to std::memset (#8408) 2018-12-15 22:23:31 +01:00
Ted John 06f203a7e7 Implement surfaces, edges and stations as objects 2018-12-09 23:30:40 +00:00
roosen5 d9806305b0 Fix #8358: infinite loop when changing vehicle count on stopped ride. (#8375)
The sprite_remove in Sprite.cpp tries to find itself inside the quadrant.
It does not find itself, and because the rest of the code assumes that it will always find it
The normal code tries to set the value of the next_in_quadrant so that whoever points at it, will now point at its next sprite.
But because it didn't find whoever was pointing to it, it would set the pointer to SPRITE_INDEX_NULL to its next sprite.
This would lead to cycles in the linked list

The reason that the sprite was not found is that during the entry of a ride, the position of a peep is set to LOCATION_NULL
Exiting a ride sets it back to whatever the location is of an exit.
However stopping a ride that still has people in it would go wrong, as the people are removed from the ride through ride_remove_peeps

This function was called during the PaintWindows.
The fact that this function is called during the painting is the problem, because of the tweening:
Before painting all the positions are stored (Which would at that point be the LOCATION_NULL), during the painting
the peep would be removed from the ride, setting their location to the enrance/exit
After painting is done all the positions are restored again, so the patched position is forgotten and then it would be
removing a sprite with location LOCATION_NULL and that goes wrong

The fix is to have the window update outside of paint
2018-12-09 20:46:04 +01:00
Matt 468d94a6ca Remove gCurrentViewportFlags 2018-12-05 23:09:17 +01:00
Hielke Morsink 354d973a48 Use std::size instead of Util::CountOf 2018-11-23 21:59:08 +01:00
Gymnasiast a2033bc8ab Add non-breaking spaces 2018-11-09 23:41:18 +01:00
Gymnasiast 72d2ebd4d7 Add Russian rouble sign 2018-11-09 23:40:18 +01:00
Michael Steenbeek f8add7f62e
Rename rct_tile_element to TileElement 2018-11-01 13:53:50 +01:00
ζeh Matt e5eb61d38d Fix scrolling banners drawing invalid text 2018-10-23 19:44:14 +02:00
Michał Janiszewski 63c6486a7f
Add missing header guards (#8081) 2018-10-10 23:27:25 +02:00
Michał Janiszewski b05e66e67d Fix invalid access to font descriptor 2018-10-03 21:20:04 +02:00
Michael Steenbeek fd12aff8f7
Add D and E with caron
This also adds the Unicode codepoints for the remaining Czech letters.
2018-09-23 22:23:37 +02:00
Gymnasiast f07e677af1 Replace switch towers with std::map 2018-09-23 11:31:04 +02:00
Gymnasiast 7d7d0aeab5 Adopt OpenLoco's UTF-8 handling 2018-09-23 11:31:04 +02:00
Gymnasiast c46155bbda Use constant instead of raw number 2018-09-16 15:07:32 +02:00
Gymnasiast 3b5a766f34 Add glyphs for Ő, ő, Ű and ű 2018-09-01 21:03:56 +02:00
Gymnasiast 3b97f6d9f6 Add y with acute 2018-09-01 20:42:24 +02:00
Gymnasiast ab1044d2de Add C with caron 2018-09-01 20:42:24 +02:00
Gymnasiast 3a8bf352ac Fix #7804: Russian ride descriptions cut off 2018-08-13 20:35:46 +02:00
Michael Steenbeek 6d530002bc
Add ellipsis character 2018-08-13 19:57:43 +02:00
Linus Unnebäck fd07be587a
Remove Math::Clamp in favour of std::clamp 2018-08-12 16:47:12 +01:00
Michael Steenbeek fdd18dd29b
Fix #7830: Add font sprites for Romanian characters 2018-07-30 17:54:02 +02:00
Gymnasiast 8481c4ec58 Add sprite font glyph for interpunct 2018-07-24 21:07:02 +02:00
Michael Steenbeek e6472eec00 Add Turkish sprite font glyphs 2018-07-24 13:54:19 +02:00
Gymnasiast ad3528a7f1 Add sprite font glyph for the guilder sign 2018-07-23 23:44:13 +02:00
Michael Steenbeek fd133aae8a
Fix #4039: Add sprite font glyph for German opening quotes (#7811) 2018-07-23 22:02:28 +02:00
Gymnasiast 86aee96c3d Add sprite glyphs for Cyrillic/Russian 2018-07-23 18:34:59 +02:00
clang-format d787872cbe Indent preprocessor directives 2018-07-23 16:00:23 +02:00
clang-format b02dfdbc93 Binpack function arguments together
Previously when the arguments of a function wouldn't fit on a single line, clang-format would put each argument on its own line instead. By enabling the binpack parameter setting, it tried to fit as many on one line as possible instead.

Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2018-07-23 16:00:22 +02:00
clang-format 95ce592579 Enforce not breaking before assignments and function names
Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2018-07-23 16:00:19 +02:00
Hielke Morsink 9bfa8bdbe8 Apply format on new/updated code before rebase 2018-07-23 16:00:17 +02:00
Hielke Morsink 472320d8f3 Correct formatting up to the management folder
I went over the commits ab7f22f..8726712 (bulk format commits for game actions to management inclusive) and corrected all mistakes I found. Most of them have to do with arrays missing trailing commas, making clang-format indent the entire array or not add breaks between the values.
2018-07-23 16:00:15 +02:00
clang-format 602aac47ba clang-format drawing 2018-07-23 16:00:04 +02:00
Michael Steenbeek 5fdc4637cd Add drawing code for new sprite glyphs 2018-07-20 17:33:20 +02:00
Michael Steenbeek 93bc11a93a Refactor _spriteFontCharacterWidths 2018-07-20 15:56:21 +02:00
Michael Steenbeek 41dcae581a Remove support for the unused big font 2018-07-20 15:56:21 +02:00
Michael Steenbeek b2873d2f86 Use more constants 2018-07-20 15:08:25 +02:00
Michael Steenbeek 1b08fb4e69 Replace our own integer types with standard ones 2018-06-20 17:30:40 +02:00
Michael Steenbeek ec3a1e575e
Replace Math::Min and Max with std variants 2018-06-20 17:11:35 +02:00
Hielke Morsink 0cf256ac9e Ready copyright notice for clang-format
Clang-format sees the text behind `#pragma region` as code and formats it. Instead of stating the copyright and date there, it's now in the comment block right below it. The text "Copyright" is left in the `#pragma region` line, as clang-format sees it as a single identifier.

I took the opportunity to normalize the dates, and add the copyright notice to the source files where it was missing them (except for third-party and the generated resources.h file).
2018-06-15 14:07:34 +02:00
Hielke Morsink aad1e69d7e
Add parentheses to macro arguments (#7686)
This adds parentheses around macro arguments that are either negative or used for calculations inside the macro itself. Doing this avoids getting errors in code that may look right.
2018-06-15 10:54:05 +02:00
Ted John fdb1d98868
Move rain window loop to libopenrct2ui (#7684) 2018-06-15 07:46:04 +01:00
Aaron van Geffen 2cb0947620 Fix #7535: Render ẞ ligature in sprite font. 2018-06-11 22:34:01 +02:00
Aaron van Geffen 760f274d81 Fix #7616: Use unicode dingbats for +/- buttons in CJK languages. 2018-06-11 22:20:51 +02:00
Michał Janiszewski 5174119491 Disable -Wdocumentation for FreeType includes 2018-06-11 10:17:10 +02:00
Hielke Morsink 204dd4439b Mark unused arguments in the libopenrct2 project
For dummy classes and functions with empty bodies I've only commented out the arguments, for all others I used C++17's [[maybe_unused]].
2018-06-06 21:03:11 +02:00
Hielke Morsink 5d0022a5cb Remove argument list from zero-initializers with zero/false/nullptr value 2018-06-04 19:50:46 +02:00
Hielke Morsink 7aada25ed2 Clarify disabling of warnings for unused function (#7617) 2018-06-02 22:30:41 +02:00
Ted John b3c17b215f Use single output folder for msbuild obj files
This requires unique named source files within a project.
2018-06-01 09:37:49 +02:00
ζeh Matt ee56021067 Minor code cleanup. (#7538) 2018-05-18 22:50:57 +02:00
Michał Janiszewski a2ef4bd699
Exclude pre-formatted blocks from clang-format (#7520)
[ci skip]
2018-05-16 20:41:29 +02:00
Hielke Morsink 6c65c3d64d
Merge pull request #6774 from janisozaur/fixes
Various code improvements
2018-05-15 14:38:43 +02:00
Ted John afdcff8f9a
Merge pull request #7512 from IntelOrca/feature/parkobj
Introduce parkobj and json object .png support
2018-05-14 18:08:54 +01:00
Ted John 20fdd46b96
Fix #7513: OpenRCT2 freezes on shutdown (#7514)
Store drawing engine and painter inside Context so that it is disposed before Context.
2018-05-13 15:52:59 +01:00
Ted John 0f0bb021d6 Add support for raw images 2018-05-13 11:36:35 +01:00
Ted John 580f1baff2 Get basic relative .png loading 2018-05-13 11:36:35 +01:00
Ted John f212894eb0 Fix clang builds 2018-05-13 01:11:56 +01:00
Ted John 428dd05dcf Refactor ImageImporter 2018-05-13 01:11:56 +01:00
Ted John bffbf5857d Refactor image importer out into new class 2018-05-13 01:11:56 +01:00
Hielke Morsink f9dd981234 Further fixes
- Use `= 0` for initializing types
- Add default values to some structs, instead of zero-initializing their instances with `{}`
- Use `std::make_unique` in Network.cpp
- Remove trivial constructors and destructors
- Improve readability of expression in Vehicle.cpp
2018-05-12 16:58:08 +02:00
Ted John 302fe00805 Always pass shared_ptr by reference 2018-05-11 20:39:00 +01:00
Ted John 7b28078da2 Remove use of gUseTrueTypeFont 2018-05-11 20:37:48 +01:00
Ted John 466c465d44 Use unique_ptr and shared_ptr for IDrawingEngine 2018-05-11 20:37:48 +01:00
Ted John 7b610fd3c0 Use shared_ptr more for UiContext in relation to DrawingEngine 2018-05-11 20:37:48 +01:00
Ted John 7dc170ef85 Use shared_ptr for long-life objects
Use unique_ptr and shared_ptr for IContext, IPlatformEnvironment, IUiContext, and IAudioContext.
2018-05-11 20:37:48 +01:00
Michał Janiszewski 0a92e74ced Minor fixes 2018-05-11 15:38:30 +02:00
Hielke Morsink 8d10bfb5a1 Add namespace closing comments 2018-05-04 22:54:43 +02:00
Hielke Morsink bc44792da9 Pack nested namespaces together 2018-05-04 22:54:43 +02:00
Michael Steenbeek 3aac52cf44 Fix rendering of inverted exclamation mark 2018-04-25 13:47:07 +02:00
Ted John 42f46d15e3
Merge pull request #7414 from OpenRCT2/refactor/string-conversions
Refactor string conversion between RCT2 and UTF8
2018-04-25 10:14:39 +01:00
Hielke Morsink bf4f68fe33 Use enum type that guarantee to support its values
By default enumerators use type `int` which can store values up to `1 << 31 - 1`. The clang compiler generates this error for enums values that use the sign bit: `enumerator value is not representable in the underlying type 'int'.`

To get rid of those warnings (and technically improve the code) the erroneous enums are now of type of `uint32`.

Note: I've skipped peep.h to prevent conflicts with the peep refactor branch.
2018-04-24 16:51:42 +02:00
Hielke Morsink 30063984e6
Delete unused function arguments or mark them so (#7426)
This aims to make future refactoring easier. The arguments are removed where possible, but kept and marked with C++17's [[maybe_unused]] where they could not be removed (e.g. when they are used as a callback, rather than called directly).

I've skipped the rides/<category>/* and peep/* source files, because the rides source files are mostly generated and have a ton of unused variables, and the peep source files are being refactored.
I've also skipped most of window/* source files, because most of the functions are used as callbacks and will be bulk-renamed at some point.
2018-04-20 13:56:37 +02:00
Ted John deaa60f8f1 Refactor string conversion between RCT2 and UTF8
Use Win32 API for conversion on Windows for non-1252 code pages instead of built-in tables.
2018-04-18 13:16:20 +02:00
Duncan 0ab3d0955c
Merge pull request #7310 from OpenRCT2/json-objects
Add support for new JSON object format
2018-04-08 10:45:55 +01:00
Hielke Morsink a51462b0fd Include necessary files for compiling headers
This commits works towards #7289. It includes files that it depends on, or forward declares types when possible. It may seem like this only increases compilation time, but before this commit they depended on the other includes of the source files that use them.
2018-03-31 23:07:14 +02:00
Ted John 3ead0f4289 Finish loading water JSON objects 2018-03-26 21:37:23 +02:00
Ted John bf7c3931e7 Parse images from JSON 2018-03-26 21:35:44 +02:00
Ted John f6fd79eca4 Move length calculation to ImageTable.cpp 2018-03-26 21:35:44 +02:00
Ted John 32d588d765 Fix toilets image loading 2018-03-26 21:35:44 +02:00
Michał Janiszewski 67f74119cf Fix missing headers 2018-03-20 00:27:58 +01:00
Michał Janiszewski cd065d4f41 Reduce includes in common header 2018-03-20 00:27:58 +01:00
Michał Janiszewski 3303246b09 Reduce header inclusions 2018-03-20 00:27:58 +01:00
LRFLEW d4cfad8ab2 Fix 'different language linkage' error with Xcode 2018-03-18 23:29:13 +01:00
Michał Janiszewski 28391eaf5d Move cstring out of common.h 2018-03-18 23:29:13 +01:00
Michał Janiszewski f3bdc431e1 Add lost headers 2018-03-18 23:29:13 +01:00
Michał Janiszewski 54cc1ebcdf Reduce includes in common.h 2018-03-18 23:29:13 +01:00
Michał Janiszewski 764520076f
Reduce header inclusion
* Update includes in PlatformEnvironment.cpp

* Update includes in ParkImporter.h

* Update includes of OpenRCT2.h

* Update includes in Intro.h

* Remove unused include from Input.cpp

* Update includes of Imaging.h

* Update includes in Game.h

* Update includes in Editor.h

* Update includes of Context.cpp

* Update includes in Cheats.cpp, CmdlineSprite.cpp

* Update includes of some source files

* Update includes in some cpp files

* Update includes in some cpp files

* Update includes in TextureCache.h

* Fix tests

* Update includes in Font.cpp

* Update includes in LightFX files

* Update some includes

* Fix GCC builds

* Update some includes

* Update some includes

* Update includes in FontsFamilies.*

* Update includes of Console.h

* Improve includes in Window.h

* Improve headers in Viewport.h/Window.h

* Fix MSVC build

* Fix network-less builds

* Reduce inclusion of Map.h
2018-03-13 13:14:02 +01:00
Michael Steenbeek d481cca2ed
Remove some redundant casts and fix rct_sprite::AsDuck() 2018-02-15 13:04:25 +01:00
Hielke Morsink 55979a3fff Remove and replace C typedefs
`typedef struct/union/enum name { ... } name_again;` is not needed whe compiling C++, moving the name at the back to be in front of the object and removing `typedef` makes it usable the very same way.
This also replaces typedefs with the using keyword. They have better readability, especially for function pointer types, and would allow more flexibility when used with templates.
2018-02-14 09:42:26 +01:00
Aaron van Geffen 3ea6a3ea2f Implement optional full font hinting for scrolling text (banners). 2018-02-13 10:15:27 +01:00
Aaron van Geffen bd928bc27e Make font hinting optional on a per-font basis.
Previously, hinting could only be disabled globally.
This commit disables hinting if the hinting threshold is set to 0.
Note that this parameter is configurable through config.ini, too.
2018-02-13 10:15:27 +01:00
Aaron van Geffen 1809eec079 Improve TrueType font appearance for scrolling texts.
This makes the scrolling text drawing code respect banner font y-offset definitions.
Font definitions are also adjusted accordingly. Definitions set prior were ignored
by the game thus far, hence the need for adjustment.
2018-02-13 10:15:27 +01:00
Michał Janiszewski ad27806534 Implement AVX2 masking 2018-02-12 22:24:22 +01:00
Ted John 4d8fe051e8 Remove most usages of object_entry_groups 2018-02-12 12:48:41 +00:00
Ted John f031763531 Use rct_gx for g1 2018-02-05 19:04:01 +00:00
Ted John b8e93177d8 Use std::vector for g2 and csg 2018-02-05 18:56:03 +00:00
Ted John b0755123fd Fix loading of bad g1.dat 2018-02-05 18:47:40 +00:00
Gymnasiast 34a6b5ef92 Remove __cplusplus ifdefs 2018-02-05 16:20:15 +01:00
Gymnasiast 778ba466c5 Remove almost every extern C block 2018-02-05 16:20:15 +01:00
Aaron van Geffen f5db6dbde9 Replace constants with palette codes. 2018-02-05 00:20:12 +00:00
Richard Jenkins 95dfcea6bd Implement #4984: Add option to highlight vomit, litter and handymen 2018-02-05 00:20:12 +00:00
Ted John 0c71855769 Replace Memory::Copy with std::copy 2018-02-04 12:40:24 +00:00
Ted John 7851446a6f Replace Memory::Set with std::fill or similar 2018-02-04 12:35:02 +00:00
Gymnasiast d87aa7a845 Remove unused static functions 2018-02-01 14:42:51 +01:00
Gymnasiast 3df60e5acd Move ttf_sdlport.c to C++ 2018-02-01 14:42:51 +01:00
Ted John 8304f01aef Fix #5809: Support Steam RCT1 file layout
Checks RCTdeluxe_install sub directory for csg1.1 and csg1i.dat when loading CSG images.
2018-01-23 18:28:33 +01:00
Hielke Morsink 3633d56e3e Refactor and cleanup in-game console to use C++ strings
Instead of storing the console text in one large buffer, it gets stored in a vector of strings. This makes the code easier to understand, as the `std::string`s now handle the buffer lenghts, instead of doing that manually and bloating the code with it, but at the cost of some performance (not noticable though). This fixes an issue where the buffer would be cut off when the total length exeeded the buffer length.
With this commit printed warnings and errors will have a red and yellow colour. It looks like this was intended, but it didn't work before, and makes `gfx_draw_string` and related functions take const strings.
2018-01-23 16:43:33 +01:00
Gymnasiast 498ca56f57 Fix unicode values of some characters 2018-01-22 12:16:22 +01:00
Marijn van der Werf 430bf482f2 Add viewport getter 2018-01-18 22:57:55 +01:00
Marijn van der Werf aa0933d08a Convert rct_window to opaque pointer 2018-01-18 22:57:55 +01:00
Michał Janiszewski 3ba0cc3dae Add missed constexprs 2018-01-14 16:13:37 +01:00
Ted John 742690b4f4 Add enums for weather effect and rain level 2018-01-14 01:06:47 +00:00
Ted John 68202db51c Make ClimateWeatherData and ClimateWeatherGloomColours internal to Climate.cpp 2018-01-14 01:06:47 +00:00
Ted John 83cdd56825 Unify current and next climate state into common struct 2018-01-14 01:06:47 +00:00
ZehMatt 84f2917f59 Use const and constexpr whenever possible. 2018-01-11 22:29:08 +01:00
Aaron van Geffen 004e60ccc6 Use virtual columns to align date and time.
This also makes the date column use a fixed width. Useful when resizing.
2018-01-11 20:27:40 +01:00
Michael Steenbeek cd5a1ba888 Compile files in world folder as C++ 2018-01-11 13:25:09 +01:00
Michał Janiszewski 5a8cfb16c8 Clang-format guards for static data
This guards most of the hardcoded data from clang-format.

[ci skip]
2018-01-11 09:19:56 +01:00
Michał Janiszewski 6a65f791b6 Add const to arguments 2018-01-10 23:58:57 +01:00
Michał Janiszewski 77c4fa00bc Use nullptr instead of NULL in C++ 2018-01-07 21:43:37 +01:00
Ted John c3eab7ead6 Refactor window.c to C++ 2018-01-07 12:39:58 +01:00
Ted John f18595a1c1 Refactor viewport.c to C++ 2018-01-07 12:39:58 +01:00
Ted John 630a5065db Refactor colour.c to C++ 2018-01-07 12:39:58 +01:00
Michael Steenbeek 755add6c9a
Compile localisation folder as C++ 2018-01-06 18:32:25 +01:00
Michael Steenbeek 3882715c38 Fix Xcode project 2018-01-05 23:04:52 +01:00
Ted John 3dcbebcf68 Refactor drawing.c to C++ 2018-01-05 22:57:57 +01:00
Ted John 144dbf431c Refactor ttf.c to C++ 2018-01-05 22:57:55 +01:00
Ted John 0c3c998177 Refactor lightfx.c to C++ 2018-01-05 22:57:55 +01:00
Ted John 559ec8a404 Refactor font.c to C++ 2018-01-05 22:57:54 +01:00
Ted John 36d4e7753f Refactor scrolling_text.c to C++ 2018-01-05 19:58:15 +00:00
Ted John cb468cadb6 Refactor string.c to C++ 2018-01-05 19:58:15 +00:00
Ted John 90b63b09f8 Refactor rect.c to C++ 2018-01-05 19:58:15 +00:00
Ted John ad406e5ae0 Refactor line.c to C++ 2018-01-05 19:58:15 +00:00
Ted John 02c58a6c5a Remove custom base Exception class 2018-01-05 18:11:47 +00:00
Michał Janiszewski b2bc974fe7
Use nullptr where possible 2018-01-04 06:58:44 +01:00
Michael Steenbeek 91589f57c6 Compile map.c as C++ 2018-01-03 20:40:51 +01:00
Michael Steenbeek 347ff702d0 Refactor objects 2018-01-03 10:16:51 +01:00
Michał Janiszewski 566991897e Add compile guard to not miss SSE4.1 2018-01-01 23:49:09 +01:00
Michał Janiszewski 645b36169d Move SSE4.1 code to its own file, detect SSE4.1 in runtime 2018-01-01 23:49:09 +01:00
Michał Janiszewski c04e720f9f Hide mask_sse4_1 completely on non-SSE builds 2018-01-01 23:49:09 +01:00
Michał Janiszewski b30fb66878 Add SSE4.1 implementation of masking 2018-01-01 23:49:09 +01:00
Gymnasiast 2a6f2c1763 Fix #6114: Crash when using a non-LL CSG1.DAT
The game will now check for the number of entries in CSG1.DAT. If it's too few, it will now no longer try using its sprites, but print out a warning instead.
2017-12-31 21:03:40 +01:00
Michał Janiszewski b574c23172 Fix function declaration 2017-12-26 18:09:00 +01:00
Michał Janiszewski 8089cadc40 Reduce code duplication 2017-12-26 18:08:56 +01:00
Marijn van der Werf 6251577305 Refactor direct access to window list 2017-12-25 15:06:06 +01:00
Marijn van der Werf 0048ef091f Refactor direct access to window list 2017-12-25 15:06:06 +01:00
Hielke Morsink b6718d08d4 Remove unnecessary return statements 2017-12-21 23:47:30 +01:00
Michael Steenbeek c4f44e5e7a Compile files in paint folder as C++ 2017-12-17 17:24:36 +01:00
LRFLEW eed00ea363 Add Vsync Toggle to Options 2017-12-14 11:18:28 +01:00
Michael Steenbeek 1a9975d683 Compile util and cheats as C++ 2017-12-14 10:03:21 +01:00
Michael Steenbeek 6dc49d643a Compile files in base dir as C++ 2017-12-13 08:03:48 +01:00
Hielke Morsink 40cea0e7e7 Fix #2607: Rain rendered incorrectly in additional viewport 2017-12-08 11:24:45 +01:00
Michael Steenbeek 0ffa2b541a Use more consistent terminology and remove some Americanisms 2017-12-05 10:23:36 +01:00
Michael Steenbeek 60d8865efb Compile game.c and game.h as C++ 2017-12-05 09:10:27 +01:00
Ted John ebf43c2529 Fix testpaint 2017-12-04 19:04:07 +00:00
Ted John 99d7aaa2d6 Remove RCT2 interop 2017-12-04 19:04:06 +00:00
Michał Janiszewski 079d223663
Actually fix RCT2 builds 2017-12-02 19:46:02 +01:00
Ted John 64f129c616 Fix RCT2 builds 2017-12-02 18:03:54 +00:00
Ted John 6ef5154b02 Fix #6761: An assertion failed - Invalid Font index 65675
Special font bases were not converted in font_sprite_get_codepoint_width.
Assert converted to safe warning.
2017-12-02 11:47:24 +00:00
Ted John 1f456d3e8e
Merge pull request #6638 from janisozaur/font-guard
Guard access to font
2017-12-01 20:13:58 +00:00
Michał Janiszewski f46f2d6821 Fix g1 image ID check (#6742) 2017-11-27 22:03:54 +00:00
Michał Janiszewski 9fcef9ed07 Only guard font access in RCT2-less builds 2017-11-26 21:48:54 +01:00
Michał Janiszewski 8097beeae1 Guard access to font 2017-11-26 21:38:50 +01:00
Ted John 8c53b6a70b Fix #6681: Tons of visual glitches when zooming out
Regression from #6574. Restoring the backup of SPR_TEMP was removed which was necessary as it is the sprite for grass tile zoomed out. Instead make SPR_TEMP a special sprite ID which is not used for anything else apart from temporary sprite drawing.
2017-11-20 13:48:00 +00:00
Aaron van Geffen 13f99e495e Reduce console verbosity for TTF loading. 2017-11-17 10:31:26 +01:00
Ted John eb98bfaa31 Log invalid g2 access 2017-11-05 21:17:35 +00:00
Ted John 48d1930a6c NULL -> nullptr 2017-11-05 21:12:46 +00:00
Ted John 446f57e43b Fix NO-RCT2 builds 2017-11-03 22:24:04 +00:00
Ted John 4232be9fc2 Remove remaining external uses of g1element 2017-11-03 22:18:10 +00:00
Ted John 444a8c1602 Const protect get_g1_element 2017-11-03 22:18:10 +00:00
Ted John 5a05bd51e5 Use get_g1_element and add null checks 2017-11-03 22:18:10 +00:00
Christian F. Coors 06afeeda9a Apply some refactoring 2017-11-02 12:22:28 +01:00
rwjuk 3125956b77 Fix off-by-one error in placement of centred text 2017-10-31 21:04:42 +01:00
Michael Steenbeek af845beb61 Replace mapElement with tileElement 2017-10-31 19:59:06 +01:00
Michael Steenbeek ce8d9cc71b Rename map_element to tile_element 2017-10-31 19:59:06 +01:00
LRFLEW f105237a2e OpenGL: Delay Palette Mapping Until Final Framebuffer Copy to Screen 2017-10-30 16:21:49 +01:00
Aaron van Geffen 8c8a2317f6 Initial prototype for font families. 2017-10-30 12:06:05 +01:00
Aaron van Geffen a0fb2a6d7c Fix game console overflowing when using TTF for rendering. 2017-10-19 21:26:53 +02:00
Michał Janiszewski 8fd2266bda Refactor includes (#6512)
* Refactor Intent.h inclusion

* Use forward declaration of ITcpSocket

* Remove unused include

* Forward declare rct_ride_entry

* Remove unused headers

* Forward-declare rct_drawpixelinfo

* Remove unused headers

* Lower header include from header to source file

* Reduce included headers

* Reduce includes
2017-10-19 10:01:05 +02:00
Michael Steenbeek 79365b7a91 Merge pull request #6075 from marijnvdwerf/ui/text-paint
Refactor text painting
2017-10-18 07:49:13 +02:00
Marijn van der Werf fcfa4ffcc2 Apply requested changes 2017-10-17 22:24:34 +02:00
Aaron van Geffen 08f7aba817 Rename 'blend' function to 'blendColours'. 2017-10-15 22:31:11 +02:00
Aaron van Geffen 551fdabc7f Make the hinting threshold configurable per font.
This addresses the issue that tofu would not show up in Arial on macOS if the
threshold was set to 60. It being the fallback font, it is important that they
do, which requires lowering to at most 43.

However, it is even more important that the threshold is left at 60 for kanji
in e.g. Japanese to render properly.

Hence, for the moment, Arial is the only font now using a hinting threshold
of 40, for now.
2017-10-15 22:31:11 +02:00
Aaron van Geffen 899c859948 Use light hinting mode iff hinting is enabled.
This makes use of TTF_SetFontHinting, which was ported from SDL_ttf for the occasion.
2017-10-15 22:31:11 +02:00
Aaron van Geffen 5e7f9c4762 Allow enabling/disabling hinting through console. 2017-10-15 22:31:11 +02:00
Aaron van Geffen d4c5218ba2 Move blending code to colour.c. 2017-10-15 22:31:11 +02:00
Marijn van der Werf d6349d0095 Calculate blended palette index 2017-10-15 22:31:11 +02:00
Aaron van Geffen 0ed3ef3704 Use ColourMapA where possible. 2017-10-15 22:31:11 +02:00
Aaron van Geffen 4b7ebcb51c Handle two rare cases: for red losses in finance window, and text in theme window. 2017-10-15 22:31:11 +02:00
Aaron van Geffen fec0568b29 Shade black backgrounds differently (e.g. IME) 2017-10-15 22:31:11 +02:00
Aaron van Geffen f2e795b4ef Handle hinted font rendering in scrolled texts, too. 2017-10-15 22:31:11 +02:00
Aaron van Geffen 346cfdf135 Account for colour intensity as well as outlined texts. 2017-10-15 22:31:11 +02:00
Aaron van Geffen 2dcf9c73e7 Make font hinting optional through config.ini. 2017-10-15 22:31:11 +02:00
Aaron van Geffen ea034e85fa Simulate font hinting when using TrueType fonts for better legibility. 2017-10-15 22:31:11 +02:00
Aaron van Geffen 3357d32ec4 Port TTF_RenderUTF8_Shaded and TTF_drawLine_Shaded from SDL_ttf. 2017-10-15 22:31:11 +02:00
Tomas Dittmann e393ff1f22 Stop using (void*)-1 for invalid pointers 2017-10-15 15:53:16 +02:00
Ted John a65192b141 Do not use float 2017-10-14 23:38:51 +02:00
Ted John a8c9c758f4 Fix a couple of bugs 2017-10-14 23:38:51 +02:00
Ted John 55c420b738 Fix code style 2017-10-14 23:38:51 +02:00
Marijn van der Werf d596c0139f Combine text paint functions 2017-10-14 23:38:51 +02:00
Marijn van der Werf c01bcea391 Introduce more constants for text rendering 2017-10-14 23:38:50 +02:00
Michael Steenbeek 7f9c25a7a9 Use constant for LOCATION_NULL, split off location stuff to Location.h 2017-10-13 22:23:07 +02:00
Michael Steenbeek 3c8184dfa1 Handle Polish in the RCT2-to-Unicode conversion
Also removed the misidentified A_MINUSCULE and CENT.
2017-10-10 09:22:38 +02:00
Michael Steenbeek 71686e88b5 Render Polish with the sprite font
Fixes the sprite lookup table for the Polish characters.
Switches the font settings for Polish from TTF to sprite.
2017-10-10 09:22:38 +02:00
vector-of-bool 57a8bbac23 Respect POSIX path separators on Windows (#6356) 2017-10-08 21:28:38 +02:00
LRFLEW 11cdcea72b Fix RCTC g1.dat rendering issues 2017-09-30 19:18:31 -05:00
LRFLEW e177811115 Add RCTC g1.dat support 2017-09-29 10:44:23 +02:00
Michał Janiszewski 5ab9f938a7 Update files missed in the great extern "C" cleanup of 2017 2017-09-28 23:29:16 +02:00
ZehMatt 5187946bc9 Fix #6309: Lightfx being enabled with incompatible drawing engine. 2017-09-28 08:01:25 +02:00
Michał Janiszewski 00fd18809c Move extern "C" {} blocks to headers (#6282) 2017-09-18 17:05:28 +02:00
Gymnasiast a28509e24c Split Ride and rct2_ride 2017-09-12 11:16:57 +02:00
Duncan 04e217a04c Remove unused global palette pointer (#6247)
Moved one use of the palette pointer into a parameter
2017-09-03 10:16:51 +01:00
Ted John f81ee49015 Pass paint session to remaining non-track called functions 2017-09-02 23:41:02 +01:00
Ted John 46c2e52b5c Pass paint_session to more functions 2017-09-02 20:25:03 +01:00
Ted John eb7b1e7b7e Remove global, gPaintMapPosition 2017-09-02 17:11:59 +01:00
Ted John 1d04f334e3 Change more paint globals to use gPaintSession 2017-09-02 17:11:58 +01:00
Ted John cb09357bba Create paint_session to replace paint globals 2017-09-02 17:11:58 +01:00
ζeh Matt 1f3ccae8b1 Refactor remaining image flag constants to defined G1_* flags. (#6217)
Refactor gUnk9DE568 and gUnk9DE56C to be type of rct_xy16 called gPaintSpritePosition
Rename unk_9ABDA4 to gCurrentColourPalette.
Rename gUnkEDF81C to gCurrentImageType.
Rename sub_679236_679662_679B0D_679FF1 to pixel_is_present.
Remove unused variables _unk9ABDAE, _unk9AC149, unk_9E3CE4, only ever assigned but never read.
Remove unreferenced variable unk_9E3CDC.
Clean up some parts in sub_679236_679662_679B0D_679FF1.
Remove function sub_68371D and references, it assigns variables that are never used.
Add assert determine if unused code.
2017-09-02 14:01:08 +01:00
Ted John 3f1991804a Add debug option to show dirty blocks 2017-08-31 22:36:15 +01:00
Michał Janiszewski 4708af474d Fix MinGW builds in release mode 2017-08-31 23:24:47 +02:00
Michał Janiszewski d698ad1100 Convert NULL -> nullptr in C++ 2017-08-15 11:51:56 +02:00
duncanspumpkin 18d082053e Rename cpp files to use TitleCase 2017-08-04 18:12:54 +02:00
wolfreak99 ffc1dc6376 Add OpenRCT2 information and changelog to About window 2017-08-04 08:38:35 +02:00
Ted John 8b2eb8a13e Move screen variables to OpenRCT2.h 2017-07-29 20:29:29 +01:00
Oliver Freyermuth d42b9fc6df X8DrawingEngine: Only disable warnings which the compiler supports.
This fixes compilation with gcc 4.9.4.
2017-07-28 09:56:49 +02:00
Gymnasiast a67b248956 Update references to sub_688217() 2017-07-26 14:40:28 +02:00
Michael Steenbeek 367efa2020 Use remap flags, SPRITE_ID_PALETTE_COLOUR_1 and _2 in many more places 2017-07-20 20:56:29 +02:00
Michał Janiszewski ee07695cce Manually hoist consts before the loop
It is optimised in release builds, but it will help in debug mode
2017-07-20 19:36:37 +02:00
Michał Janiszewski 8c9da63aa5 Make drawing loop only depend on loop counter (#5954) 2017-07-20 18:09:22 +01:00
Gymnasiast 260f342d73 Fix typos in (unused) defines and comment 2017-07-20 16:18:36 +02:00
Ted John 01b0047675 Invert Painter dependency
Make painter call into the drawing engine, rather than the drawing engine create and call the painter.
2017-07-16 23:25:11 +01:00
Ted John ac6da51dbb Use IPlatformEnvironment for loading g1.dat 2017-07-16 23:25:11 +01:00
Ted John cb884dad11 Refactor rct2_draw to a new Painter class
Right now this is created for each drawing engine, but should eventually be a dependency into them.
2017-07-16 23:25:11 +01:00
William Wallace ae110a9159 Allow switching between OpenGL and other renderers without restarting 2017-07-13 19:04:37 +01:00
Ted John 09bb7bfd6c Allocate strings with new instead of malloc 2017-07-02 11:37:01 +01:00
Ted John e9519d2d8b Fix #5507: RCT1 path check is case-sensitive on Linux
If the csg path does not exist, find the first file in the directory that matches (case insensitive).
2017-06-30 21:11:35 +01:00
Ted John e265fa8948 Fix crash when headless server creates money fx (#5729)
Ensure headless instances of the game, which do not have graphics loaded, do not try to measure the string for new money effect sprites.
2017-06-29 12:30:49 +01:00
Ted John 4f1cfb4631 Don't load graphics for headless 2017-06-25 23:19:24 +01:00
Ted John f275e5ba9b Remove all platform.h includes from header files
System headers, particularly windows.h polute the namespace too much with macros and unwanted definitions. Do not use them in header files.
2017-06-25 18:59:56 +01:00
Ted John 89d43c1120 Merge pull request #5702 from IntelOrca/refactor/nosdl/freetype2
Remove SDL2_ttf dependency, replace with some code form SDL2_ttf without SDL2 dependencies and instead only requiring freetype alone.
2017-06-25 11:35:06 +01:00
Ted John 6368a29d39 Fix NO_TTF builds 2017-06-25 00:18:08 +01:00
Ted John 16d6ddd22b Remove unused code from SDL_ttf 2017-06-24 23:40:46 +01:00
Ted John 8046cbc707 Replace SDL2 calls 2017-06-24 23:31:40 +01:00
Ted John b7fd89361b Use complete SDL_ttf code 2017-06-24 23:13:07 +01:00
camthesaxman c301e83a64 fix water rendering 2017-06-24 18:53:25 +02:00
Ted John 9ee1bbe4b5 Add some TTF code, poor 2017-06-24 14:50:30 +01:00
Ted John 2c07a55696 Refactor TTF into new source and remove SDL2_ttf 2017-06-24 14:50:30 +01:00
Gymnasiast 631f4d8907 Add a constant for RIDE_ENTRY_INDEX_NULL 2017-06-17 14:32:15 +02:00
Ted John 29f0372da8 Reduce SDL2 in headers 2017-06-12 19:56:32 +01:00
Ted John 7e9f7df7d1 Use standard platform defines 2017-06-12 18:01:51 +01:00
Ted John b563d26ffe Fix #5588: crash in object selection
Add more safety guards for -1 image IDs which can happen if images were unsuccessfully allocated during object load.
2017-06-11 11:14:58 +01:00
Ted John 5bb48f3539 Move SDL part of lightfx blend to drawing engine 2017-06-10 22:18:54 +01:00
Ted John 90aad2e2ec Use rct_palette instead of SDL 2017-06-10 22:18:54 +01:00
Ted John fc899d15ef Remove SDL_Window from IDrawingEngine and UiContext 2017-06-10 22:18:54 +01:00
Ted John a5e4a0965f Ignore final warnings for X8DrawingEngine 2017-06-10 15:48:05 +01:00
Ted John 97d68957f0 Fix segfault in screenshot command 2017-06-10 15:48:05 +01:00
Ted John df16e6a4f7 Inherit X8 engine from software engine 2017-06-10 15:48:04 +01:00
Ted John 39b3ff0251 Create new 8bpp drawing engine in openrct2 2017-06-10 15:48:04 +01:00
Ted John c1ccf2b7a6 Refactor load_palette to call gfx_invalidate_screen
Nearly all calls to load_palette were succeeded with a call to gfx_invalidate_screen. So remove these and stick just one call inside load_palette.
2017-06-07 23:24:18 +01:00
Michał Janiszewski 61d38511bc Expand tabs to spaces
This commit expands tabs to spaces (ts=4) in all the files under src/
and test/.

Until now we had two wildly different code styles with C using tabs and
new C++ using spaces. It is painful to maintain as none of the commonly
used tools support this kind of setup and in reality is needless, as we
can simply convert all the sources to spaces and have opened PRs do the
same, where needed.

Additionally, trailing whitespace has been removed.
2017-06-06 23:46:14 +02:00
Michał Janiszewski 79d76759bb Fix #5516: Update copyrights for 2017
Not all files were necessarily _changed_, but all were touched, see
https://github.com/OpenRCT2/OpenRCT2/pull/4932
2017-06-01 21:55:10 +02:00
Ted John f998172674 Fix IME text input 2017-05-29 22:38:46 +02:00
Ted John e2a7189663 Do not use SDL_Colour for gPalette 2017-05-29 22:38:44 +02:00
Ted John 3fcd42fe2b Move more window code to UiContext 2017-05-29 22:38:43 +02:00
Ted John bd9839ff50 Get the game working
Mostly just needed to resolve screen size which is now retrieved via ui context.
2017-05-29 22:38:43 +02:00
Ted John 7163973bd2 Start moving code from OpenRCT2 to Context 2017-05-29 22:38:42 +02:00
Ted John 10182879da Invert Context and UiContext dependencies 2017-05-29 22:38:42 +02:00
Ted John fedb8917c7 Create new CMake project for libopenrct2 2017-05-29 22:38:42 +02:00
Ted John 006a76c099 Refactor registration of drawing engines 2017-05-29 22:38:42 +02:00
Ted John bf3749833d Allow drawing engine registration via context interfaces 2017-05-29 22:38:42 +02:00
Ted John 19aafc4e24 Move drawing engine implementation code to openrct2-ui 2017-05-29 22:38:41 +02:00
CraigCraig 26287f5a3e More readability, grammar, spelling fixes 2017-05-15 09:28:43 +02:00
CraigCraig 58deb3a54a Grammar, readability, and spelling fixes
[ci skip]
2017-05-11 11:45:59 +02:00
Ted John 8bd0c703a7 Revert "fix and refactor DrawRLESprite2 (#5396)" as it broke water rendering
This reverts commit fde3c8a3ed.
2017-04-30 20:02:27 +01:00
Ted John 1ab90d86ca Fix exporting non-RLE sprites 2017-04-30 17:22:27 +01:00
Cameron Hall fde3c8a3ed fix and refactor DrawRLESprite2 (#5396) 2017-04-30 06:40:25 +02:00
CraigCraig e0b875398b Tons of spelling fixes (#5413)
[ci skip]
2017-04-30 06:39:24 +02:00
Michał Janiszewski 73efe0755d Validate water image id while loading palette 2017-04-24 22:56:37 +02:00
Michał Janiszewski 0414ba7f6b Verify access to sprites 2017-04-20 13:20:11 +02:00
Gymnasiast c8ecd98737 Check for both csg1.1 and csg1.dat when looking for RCT1 graphics 2017-04-12 20:08:31 +02:00
Gymnasiast 99617de70a Add method to determine if CSG1 is loaded 2017-04-11 22:38:09 +02:00
Martin Müller 3409da9aa1 Only load csg1 if necessary 2017-04-10 14:09:01 +02:00