Commit Graph

576 Commits

Author SHA1 Message Date
Tomas Dittmann 7d8695394c Add guards for nullptr and (-1) pointer accesses 2017-08-22 10:20:59 +02:00
Ted John 8b2eb8a13e Move screen variables to OpenRCT2.h 2017-07-29 20:29:29 +01:00
rwjuk 315ee6b3b5 Fix applying palette colours; SPRITE_ID_PALETTE_COLOUR_3 to _2 2017-07-28 07:52:35 +02:00
Gymnasiast 2b540b9da1 Remove direct access to small scenery's colour_1 and _2 fields 2017-07-27 21:37:34 +02:00
Gymnasiast db438a27b7 Use map_element_get_direction in more places, create map_element_get_direction_with_offset() 2017-07-27 21:23:26 +02:00
Michael Steenbeek 46de90df86 Create map_get_water_height() 2017-07-27 17:15:56 +02:00
Duncan 9a49490a0a Refactor of scenery elements (#5308)
Label scenery flags, vars and refactor small scenery into cpp file.
2017-07-25 22:26:43 +01:00
Ted John bc88cb9c2b Make TitleScreen a class (#5971) 2017-07-22 23:42:14 +01:00
ζeh Matt 6a56c8c716 Refactored some variables around paint_arrange_structs. (#5876) 2017-07-22 14:18:58 +01: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
Michael Steenbeek bb09019d9b Name and fix vehicle entry and tertiary colour flags 2017-07-20 12:57:37 +02:00
Michał Janiszewski fc59fc7573 Cache last visited node in paint_arrange_structs
This commit caches the last visited node in paint_arrange_structs and
in paint_arrange_structs_helper, which allows skipping iterating over
long linked lists that don't work well with modern CPU caches.

This is especially useful, if the list is walked just to be discarded in
the end.

This improves performance across the board, the busier the park, the
higher performance improvement.

I have verified this producing pixel-perfect results with ones before
this change by dumping giant screenshot on various parks in all zooms,
all rotations.

Results collected running before and after this change with `benchgfx`
command (https://github.com/OpenRCT2/OpenRCT2/pull/5655) on current
title sequence, YMMV.

**Park**|**Before**|**After**|**Delta**
:-----:|:-----:|:-----:|:-----:
Maian\_SOSDragon.sv6|2.80|2.43|-13.2%
Maian\_SOSFrosty.sv6|3.53|3.02|-14.4%
Maian\_SOSParabola.sv6|4.16|3.45|-17.1%
MrB.sv6|5.52|4.52|-18.1%
SpacekKing.sv6|8.53|6.52|-23.6%
SpacekMaple.sv6|7.18|5.75|-19.9%
SpacekMission.sv6|4.41|3.43|-22.2%
SpacekParadise.sv6|9.01|6.36|-29.4%
SpacekSwimmers.sv6|4.11|2.97|-27.7%
Stosky.sv6|3.34|2.36|-29.3%
 | | | 
**Average**|**5.26**|**4.08**|**-21.5%**
2017-07-18 23:01:00 +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 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
wolfreak99 15cc2a0230 Rename some small scenery flags, tidy up sub_6E1F34 2017-07-15 11:55:20 +02:00
Tomas Dittmann 77a6207100 add invalid entry pointer guards.
update the changelog
2017-07-13 10:16:34 +02:00
Duncan 454a5d9411 Fix diagonal steep slope support drawing. (#5844)
Mistake during original implementation. Fixes #5148
2017-07-10 08:16:33 +02:00
Michał Janiszewski ce24a6fb85 Prevent overflowing tunnel count (#5853) 2017-07-09 22:48:21 +02:00
Michael Steenbeek 44af1653a6 Replace 'center' with 'centre' (#5745) 2017-06-30 23:11:28 +01:00
ZehM4tt f05e94c1c6 Fixed a desync that would happen when having the guests list open. (#5632)
* Fixed a desync that would happen when having the guests list open.
* Refactored the flashing state of peeps to not affect the flags.
* Added deprecation info for SPRITE_FLAGS_PEEP_FLASHING.
* Removed unused line that used the old flag.
* Update network version
2017-06-17 12:55:41 +02:00
Ted John c8e4e6dae1 Remove usages of MAX_PATH 2017-06-11 15:42:06 +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
Ted John 430ab2db5c Fix double negative showing on money effects 2017-06-06 18:58:14 +01:00
Michael Steenbeek f3b4c88783 Merge pull request #5532 from OpenRCT2/sub_hex_fix
Name sub_<hex>() functions
2017-06-06 16:14:54 +02:00
Michał Janiszewski 3c7499f370 Validate access to _terrainEdgeSpriteIds (#4752) 2017-06-06 08:25:04 +01:00
rwjuk 0797a41f80 Name sub_685EBC() 2017-06-06 00:51:34 +01:00
Ted John 30585ea2a9 Show guest money effects with high precision 2017-06-05 21:18:14 +01: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
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
Michael Steenbeek a53b01d5b9 Remove magic numbers and Americanisms 2017-05-08 23:54:38 +02:00
CraigCraig e0b875398b Tons of spelling fixes (#5413)
[ci skip]
2017-04-30 06:39:24 +02:00
Richard Jenkins 8f59b04d32 Fix #5377: Saved game keeps crashing shortly after loading
Guard against null pointers in banner_paint() (#5379)
2017-04-17 18:37:37 +01:00
Ted John 481f5d706f Fix compilation and refactor GetFrameImage 2017-03-23 17:37:25 +00:00
Ted John 3f53f8cb5d Refactor duck to C++ 2017-03-23 17:37:25 +00:00
Duncan 1654ba4fe4 Merge pull request #5236 from duncanspumpkin/refactor
Refactor fence to wall
2017-02-28 06:56:06 +00:00
duncanspumpkin ece3be303c Fix formating 2017-02-26 09:04:32 +00:00
duncanspumpkin adab7f7a6d Add set animation frame function 2017-02-25 09:36:28 +00:00
duncanspumpkin 7691dc3c10 Use functions to set and get secondary colour 2017-02-25 09:19:31 +00:00
duncanspumpkin 810bf301f3 Rename map element fence to wall 2017-02-20 21:10:49 +00:00
duncanspumpkin f54c71b61c Rename functions to wall. Refactor game commands 2017-02-20 21:02:19 +00:00
duncanspumpkin 735f1d42b9 Move fence functions into fence.cpp 2017-02-20 20:09:40 +00:00
duncanspumpkin 133266deb0 Label fence offsets 2017-02-19 11:03:05 +00:00
Ted John fb2c835d52 Include new config header 2017-02-18 15:45:10 +00:00
duncanspumpkin 50e1c831a6 Refactor fence door animation 2017-02-18 08:26:33 +00:00
duncanspumpkin fef7445f0c Use flags where known. Refactor large 3d signs slightly 2017-02-04 08:12:44 +00:00
Michał Janiszewski 04a2734593 Merge pull request #5162 from duncanspumpkin/refactor
Small refactor of world files
2017-02-02 22:53:37 +01:00
Michael Steenbeek cad39c788a Remove more magic values from metal_a_supports_paint_setup 2017-02-02 21:54:19 +01:00
duncanspumpkin e384b9a508 Label known offsets and flags of wall/fence 2017-02-02 18:52:35 +00:00
wolfreak99 99c68439b1 define MAX_PEEP_SPAWNS and MAX_PARK_ENTRANCES (#5119) 2017-01-29 22:27:14 +01:00
duncanspumpkin 35b91037e8 Refactor of footpath labeling enums 2017-01-29 10:15:29 +00:00
duncanspumpkin e2efb66d3d Minor refactor of banner and footpath enums 2017-01-29 09:40:43 +00:00
Michał Janiszewski 404fceaed9 Guard against invalid fence better 2017-01-28 21:04:08 +01:00
Michał Janiszewski 0e7c94d98a Guard fence from null entry
Allows loading
http://www.nedesigns.com/park/3626/mediterranean-mysteries/
2017-01-28 00:12:49 +01:00
duncanspumpkin 98f483e4bb Fix trailing white space. Fixed space indent 2017-01-26 19:51:31 +00:00
duncanspumpkin d951c500c5 Refactor of peep data and label known addresses
Fixes #4545. Incorrect sprite image for chicken and juice
2017-01-26 19:51:30 +00:00
zaxcav 6a4ced856e Minor code changes per reviewer comments. 2017-01-22 21:17:08 +01:00
zaxcav 87a80ac956 Minor code cleanups.
Adjusted sprite trimming.
2017-01-22 20:57:17 +01:00
zaxcav c3aabede64 Initial prototype of paint clipping.
Paint clipping is a possible future feature to assist players building in cluttered areas of a park by controlling which map elements and sprites are rendered, providing a clearer view for construction, inspection, etc.

Only clip height is supported in this prototype.

Map elements are clipped according to the map element base height (meaning *all* scenery on that map element is currently clipped with it).

Sprites are clipped according to their z value being within the "sprite volume" of any non-clipped map element (which means below clip height + 2).

Control is only provided through the console in this prototype - use the command: set paint_clip_height _value_

To turn clipping off use the command: set paint_clip_height 255

Clip heights are limited to multiples of two to coincide with the native heights of map elements.

Command "get paint_clip_height" prints the clip height as a raw value as well as the equivalent height in ft and m as used when displaying heights in-game.

At this time only painting of the main viewport is affected. There is no change to any input control handling.
2017-01-22 20:50:39 +01:00
zaxcav 5f03047c40 View clipping window fixes.
Cleaned up widget positions - looks like a proper interface now.

Remaining Issues:

- Window only displays correctly every second time it is opened;

- Clip height in Units (ft/m) is displayed without the decimal point;

- Scroll bar is not working;

- Decide how the View menu entry should work.
2017-01-22 20:45:21 +01:00
zaxcav e8d6cba5be Initial attempt at paintClip UI
Compiles but untested.

NOT INTENDED FOR MERGING
2017-01-22 20:45:21 +01:00
zaxcav 1e5b83c631 Initial prototype of paint clipping.
Paint clipping is a possible future feature to assist players building in cluttered areas of a park by controlling which map elements and sprites are rendered, providing a clearer view for construction, inspection, etc.

Only clip height is supported in this prototype.

Map elements are clipped according to the map element base height (meaning *all* scenery on that map element is currently clipped with it).

Sprites are clipped according to their z value being within the "sprite volume" of any non-clipped map element (which means below clip height + 2).

Control is only provided through the console in this prototype - use the command: set paint_clip_height _value_

To turn clipping off use the command: set paint_clip_height 255

Clip heights are limited to multiples of two to coincide with the native heights of map elements.

Command "get paint_clip_height" prints the clip height as a raw value as well as the equivalent height in ft and m as used when displaying heights in-game.

At this time only painting of the main viewport is affected. There is no change to any input control handling.
2017-01-22 20:41:34 +01:00
Ted John fc66f42c31 Add config option to enable / disable light FX 2017-01-21 12:01:01 +00:00
Michael Steenbeek 936ec799fa Add constants for CSG1 large surface sprites 2017-01-20 12:40:06 +00:00
Ted John ebc0d03601 Rename terrain edge constant arrays 2017-01-19 15:00:21 +01:00
Ted John ebebd3836c Refactor edge image arrays and add constants 2017-01-19 15:00:21 +01:00
Marijn van der Werf 2ffbbe0678 Test vertical tunnels properly 2017-01-17 23:57:53 +01:00
Broxzier b80b71cf81 Fixed typos and warnings after rebase 2017-01-14 14:31:06 +01:00
Broxzier 60603ae10a Use types from common.h 2017-01-14 12:37:31 +01:00
Michał Janiszewski 33dcb1a506 Rename types to avoid shadowing 2017-01-13 10:57:00 +01:00
Michał Janiszewski ecf77e3609 Remove redundant declarations 2017-01-13 10:02:17 +01:00
Michał Janiszewski cf670deb10 Add -Wshadow to CMakeLists and fix offenders 2017-01-13 10:02:17 +01:00
Ted John d70cd3775e Fix silent warnings 2017-01-12 18:40:49 +00:00
Ted John 18597bacb1 Fix more warnings 2017-01-12 17:36:05 +00:00
Michael Steenbeek 92feea1612 Clean up metal supports 2017-01-11 20:23:47 +01:00
Ted John 25bc798ff8 Move contents of src into project sub directory 2017-01-04 17:44:12 +00:00