diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index d5c17da2ec..243fa68f33 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 4C729BC51FC2E5F3001DFF2F /* TileInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C729BC31FC2E5F3001DFF2F /* TileInspector.cpp */; }; 4C729BC71FC2E6AB001DFF2F /* Particle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C729BC61FC2E6AB001DFF2F /* Particle.cpp */; }; 4C729BC91FC2E6E9001DFF2F /* MoneyEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C729BC81FC2E6E9001DFF2F /* MoneyEffect.cpp */; }; + 4C729BC01FC2E1BE001DFF2F /* LargeScenery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C729BBE1FC2E1BE001DFF2F /* LargeScenery.cpp */; }; 4C8667821EEFDCDF0024AAB8 /* RideGroupManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C8667801EEFDCDF0024AAB8 /* RideGroupManager.cpp */; }; 4C8B42701EEB1ABD00F015CA /* X8DrawingEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C8B426E1EEB1ABD00F015CA /* X8DrawingEngine.cpp */; }; 4C8B42721EEB1AE400F015CA /* HardwareDisplayDrawingEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C8B42711EEB1AE400F015CA /* HardwareDisplayDrawingEngine.cpp */; }; @@ -625,6 +626,10 @@ 4C729BC41FC2E5F3001DFF2F /* TileInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TileInspector.h; sourceTree = ""; }; 4C729BC61FC2E6AB001DFF2F /* Particle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Particle.cpp; sourceTree = ""; }; 4C729BC81FC2E6E9001DFF2F /* MoneyEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MoneyEffect.cpp; sourceTree = ""; }; + 4C729BBE1FC2E1BE001DFF2F /* LargeScenery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LargeScenery.cpp; sourceTree = ""; }; + 4C729BBF1FC2E1BE001DFF2F /* LargeScenery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LargeScenery.h; sourceTree = ""; }; + 4C729BC11FC2E1C9001DFF2F /* Wall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wall.h; sourceTree = ""; }; + 4C729BC21FC2E1CF001DFF2F /* SmallScenery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmallScenery.h; sourceTree = ""; }; 4C8667801EEFDCDF0024AAB8 /* RideGroupManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RideGroupManager.cpp; sourceTree = ""; }; 4C8667811EEFDCDF0024AAB8 /* RideGroupManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RideGroupManager.h; sourceTree = ""; }; 4C8B426E1EEB1ABD00F015CA /* X8DrawingEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = X8DrawingEngine.cpp; sourceTree = ""; }; @@ -2543,6 +2548,8 @@ F76C85651EC4E7CD00FA49E2 /* footpath.h */, F76C85661EC4E7CD00FA49E2 /* Fountain.cpp */, F76C85671EC4E7CD00FA49E2 /* Fountain.h */, + 4C729BBE1FC2E1BE001DFF2F /* LargeScenery.cpp */, + 4C729BBF1FC2E1BE001DFF2F /* LargeScenery.h */, 4C31B2E51FB6116100F6A38A /* Location.h */, F76C85681EC4E7CD00FA49E2 /* map.c */, F76C85691EC4E7CD00FA49E2 /* map.h */, @@ -2561,9 +2568,11 @@ 4CFBCD5D1F27CD8000D74FB6 /* SmallScenery.cpp */, 4C729BC31FC2E5F3001DFF2F /* TileInspector.cpp */, 4C729BC41FC2E5F3001DFF2F /* TileInspector.h */, + 4C729BC21FC2E1CF001DFF2F /* SmallScenery.h */, F76C85761EC4E7CD00FA49E2 /* sprite.c */, F76C85771EC4E7CD00FA49E2 /* sprite.h */, F76C857A1EC4E7CD00FA49E2 /* Wall.cpp */, + 4C729BC11FC2E1C9001DFF2F /* Wall.h */, F76C857B1EC4E7CD00FA49E2 /* water.h */, ); path = world; @@ -3294,6 +3303,7 @@ C6D2BEEA1F9BB83C008B557C /* NetworkStatus.cpp in Sources */, C64645011F3FA4120026AC2D /* Water.cpp in Sources */, F76C88851EC5324E00FA49E2 /* OpenGLFramebuffer.cpp in Sources */, + 4C729BC01FC2E1BE001DFF2F /* LargeScenery.cpp in Sources */, 4C93F1451F8B744400A9330D /* JuniorRollerCoaster.cpp in Sources */, C61FB2721FA3E25D0095FB9D /* ObjectLoadError.cpp in Sources */, F76C88861EC5324E00FA49E2 /* OpenGLShaderProgram.cpp in Sources */, diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 2d62e330ed..c08a2aa04c 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -22,7 +22,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 6298a200f6..2c126211b7 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -40,7 +40,10 @@ #include #include #include +#include #include +#include +#include enum { WIDX_PAUSE, diff --git a/src/openrct2/interface/viewport_interaction.c b/src/openrct2/interface/viewport_interaction.c index acb4df0d6c..030fabae55 100644 --- a/src/openrct2/interface/viewport_interaction.c +++ b/src/openrct2/interface/viewport_interaction.c @@ -29,6 +29,7 @@ #include "../world/footpath.h" #include "../world/map.h" #include "../world/scenery.h" +#include "../world/LargeScenery.h" #include "../world/sprite.h" #include "viewport.h" #include "../Context.h" diff --git a/src/openrct2/paint/tile_element/fence.c b/src/openrct2/paint/tile_element/fence.c index 6405b470bb..926e196e9f 100644 --- a/src/openrct2/paint/tile_element/fence.c +++ b/src/openrct2/paint/tile_element/fence.c @@ -15,17 +15,18 @@ #pragma endregion #include "../../common.h" -#include "../../world/map.h" -#include "../../drawing/drawing.h" -#include "../../world/scenery.h" -#include "../../game.h" -#include "../../ride/Track.h" #include "../../config/Config.h" +#include "../../drawing/drawing.h" +#include "../../game.h" #include "../../localisation/localisation.h" #include "../../interface/colour.h" #include "../../interface/viewport.h" -#include "../../paint/tile_element/tile_element.h" +#include "../../ride/Track.h" +#include "../../world/map.h" +#include "../../world/scenery.h" +#include "../../world/Wall.h" #include "../paint.h" +#include "tile_element.h" static const uint8 byte_9A406C[] = { 2, 2, 22, 26, 30, 34, 34, 34, 34, 34, 30, 26, 22, 2, 6, 2, @@ -157,7 +158,7 @@ void fence_paint(paint_session * session, uint8 direction, sint32 height, rct_ti uint32 tertiaryColour = 0; if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR) { - tertiaryColour = tile_element->properties.wall.colour_3; + tertiaryColour = wall_get_tertiary_colour(tile_element); imageColourFlags &= 0x0DFFFFFFF; } diff --git a/src/openrct2/paint/tile_element/large_scenery.c b/src/openrct2/paint/tile_element/large_scenery.c index 8b372fa539..c573130f36 100644 --- a/src/openrct2/paint/tile_element/large_scenery.c +++ b/src/openrct2/paint/tile_element/large_scenery.c @@ -23,6 +23,7 @@ #include "../../localisation/localisation.h" #include "../../util/util.h" #include "../../world/map.h" +#include "../../world/LargeScenery.h" #include "../../world/scenery.h" // 6B8172: diff --git a/src/openrct2/paint/tile_element/scenery.c b/src/openrct2/paint/tile_element/scenery.c index 036e18148d..9d7e1b4298 100644 --- a/src/openrct2/paint/tile_element/scenery.c +++ b/src/openrct2/paint/tile_element/scenery.c @@ -23,6 +23,7 @@ #include "../../paint/supports.h" #include "../../world/map.h" #include "../../world/scenery.h" +#include "../../world/SmallScenery.h" static const LocationXY16 offsets[] = { { 3, 3 }, diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index ab7442eafa..230930bd90 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -41,6 +41,7 @@ #include "../world/entrance.h" #include "../world/footpath.h" #include "../world/map.h" +#include "../world/LargeScenery.h" #include "../world/scenery.h" #include "../world/sprite.h" #include "Peep.h" diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 24370ada73..7af4d68e59 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -58,7 +58,9 @@ #include "../world/map_animation.h" #include "../world/park.h" #include "../world/entrance.h" +#include "../world/LargeScenery.h" #include "../world/scenery.h" +#include "../world/SmallScenery.h" class EntryList { diff --git a/src/openrct2/ride/track_design_save.c b/src/openrct2/ride/track_design_save.c index e437276a23..4edd7d8ddf 100644 --- a/src/openrct2/ride/track_design_save.c +++ b/src/openrct2/ride/track_design_save.c @@ -16,6 +16,7 @@ #include "../audio/audio.h" #include "../config/Config.h" +#include "../Context.h" #include "../game.h" #include "../localisation/localisation.h" #include "../localisation/string_ids.h" @@ -23,13 +24,15 @@ #include "../util/sawyercoding.h" #include "../util/util.h" #include "../windows/Intent.h" +#include "../world/LargeScenery.h" #include "../world/scenery.h" +#include "../world/SmallScenery.h" +#include "../world/Wall.h" #include "ride_data.h" #include "Track.h" #include "TrackData.h" #include "TrackDesign.h" #include "TrackDesignRepository.h" -#include "../Context.h" #define TRACK_MAX_SAVED_TILE_ELEMENTS 1500 #define TRACK_NEARBY_SCENERY_DISTANCE 1 @@ -349,7 +352,7 @@ static void track_design_save_add_wall(sint32 x, sint32 y, rct_tile_element *til uint8 flags = 0; flags |= tileElement->type & 3; - flags |= tileElement->properties.wall.colour_3 << 2; + flags |= wall_get_tertiary_colour(tileElement) << 2; uint8 secondaryColour = wall_get_secondary_colour(tileElement); uint8 primaryColour = wall_get_primary_colour(tileElement); @@ -534,7 +537,7 @@ static void track_design_save_remove_wall(sint32 x, sint32 y, rct_tile_element * uint8 flags = 0; flags |= tileElement->type & 3; - flags |= tileElement->properties.wall.colour_3 << 2; + flags |= wall_get_tertiary_colour(tileElement) << 2; uint8 secondaryColour = wall_get_secondary_colour(tileElement); uint8 primaryColour = wall_get_primary_colour(tileElement); diff --git a/src/openrct2/windows/EditorObjectSelection.cpp b/src/openrct2/windows/EditorObjectSelection.cpp index a9f688a590..a3515ec132 100644 --- a/src/openrct2/windows/EditorObjectSelection.cpp +++ b/src/openrct2/windows/EditorObjectSelection.cpp @@ -33,6 +33,7 @@ #include "../ride/RideGroupManager.h" #include "../sprites.h" #include "../util/util.h" +#include "../world/LargeScenery.h" #include "../windows/Intent.h" #include "_legacy.h" #include "dropdown.h" diff --git a/src/openrct2/windows/TileInspector.cpp b/src/openrct2/windows/TileInspector.cpp index bd52ef774d..0af3ae7036 100644 --- a/src/openrct2/windows/TileInspector.cpp +++ b/src/openrct2/windows/TileInspector.cpp @@ -27,6 +27,7 @@ #include "../ride/Track.h" #include "../sprites.h" #include "../world/footpath.h" +#include "../world/LargeScenery.h" #include "../world/scenery.h" #include "../world/TileInspector.h" #include "dropdown.h" diff --git a/src/openrct2/world/LargeScenery.cpp b/src/openrct2/world/LargeScenery.cpp new file mode 100644 index 0000000000..84db3f467a --- /dev/null +++ b/src/openrct2/world/LargeScenery.cpp @@ -0,0 +1,83 @@ +#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" +#include "LargeScenery.h" +#include "map.h" + +extern "C" +{ + colour_t scenery_large_get_primary_colour(const rct_tile_element * tileElement) + { + return tileElement->properties.scenerymultiple.colour[0] & TILE_ELEMENT_COLOUR_MASK; + } + + colour_t scenery_large_get_secondary_colour(const rct_tile_element * tileElement) + { + return tileElement->properties.scenerymultiple.colour[1] & TILE_ELEMENT_COLOUR_MASK; + } + + void scenery_large_set_primary_colour(rct_tile_element * tileElement, colour_t colour) + { + assert(colour <= 31); + tileElement->properties.scenerymultiple.colour[0] &= ~TILE_ELEMENT_COLOUR_MASK; + tileElement->properties.scenerymultiple.colour[0] |= colour; + } + + void scenery_large_set_secondary_colour(rct_tile_element * tileElement, colour_t colour) + { + assert(colour <= 31); + tileElement->properties.scenerymultiple.colour[1] &= ~TILE_ELEMENT_COLOUR_MASK; + tileElement->properties.scenerymultiple.colour[1] |= colour; + } + + sint32 scenery_large_get_banner_id(rct_tile_element * tileElement) + { + return (tileElement->type & 0xC0) | + (((tileElement->properties.scenerymultiple.colour[0]) &~ TILE_ELEMENT_COLOUR_MASK) >> 2) | + (((tileElement->properties.scenerymultiple.colour[1]) &~ TILE_ELEMENT_COLOUR_MASK) >> 5); + } + + void scenery_large_set_banner_id(rct_tile_element * tileElement, uint8 bannerIndex) + { + tileElement->type |= bannerIndex & 0xC0; + tileElement->properties.scenerymultiple.colour[0] |= (bannerIndex & 0x38) << 2; + tileElement->properties.scenerymultiple.colour[1] |= (bannerIndex & 7) << 5; + } + + sint32 scenery_large_get_type(rct_tile_element * tileElement) + { + return (tileElement->properties.scenerymultiple.type & TILE_ELEMENT_LARGE_TYPE_MASK); + } + + sint32 scenery_large_get_sequence(rct_tile_element * tileElement) + { + return (tileElement->properties.scenerymultiple.type >> 10); + } + + void scenery_large_set_type(rct_tile_element * tileElement, uint16 type) + { + tileElement->properties.scenerymultiple.type &= ~TILE_ELEMENT_LARGE_TYPE_MASK; + tileElement->properties.scenerymultiple.type |= (type & TILE_ELEMENT_LARGE_TYPE_MASK); + } + + void scenery_large_set_sequence(rct_tile_element * tileElement, uint16 sequence) + { + tileElement->properties.scenerymultiple.type &= TILE_ELEMENT_LARGE_TYPE_MASK; + tileElement->properties.scenerymultiple.type |= (sequence << 10); + } +} + diff --git a/src/openrct2/world/LargeScenery.h b/src/openrct2/world/LargeScenery.h new file mode 100644 index 0000000000..71998fdbb4 --- /dev/null +++ b/src/openrct2/world/LargeScenery.h @@ -0,0 +1,37 @@ +#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" +#include "map.h" + +#ifdef __cplusplus +extern "C" { +#endif + +colour_t scenery_large_get_primary_colour(const rct_tile_element * tileElement); +colour_t scenery_large_get_secondary_colour(const rct_tile_element * tileElement); +void scenery_large_set_primary_colour(rct_tile_element * tileElement, colour_t colour); +void scenery_large_set_secondary_colour(rct_tile_element * tileElement, colour_t colour); +sint32 scenery_large_get_banner_id(rct_tile_element * tileElement); +void scenery_large_set_banner_id(rct_tile_element * tileElement, uint8 bannerIndex); +sint32 scenery_large_get_type(rct_tile_element * tileElement); +sint32 scenery_large_get_sequence(rct_tile_element * tileElement); +void scenery_large_set_type(rct_tile_element * tileElement, uint16 type); +void scenery_large_set_sequence(rct_tile_element * tileElement, uint16 sequence); + +#ifdef __cplusplus +} +#endif diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index 25f66d83a4..d6fd5d0828 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -33,6 +33,7 @@ #include "map_helpers.h" #include "MapGen.h" #include "scenery.h" +#include "SmallScenery.h" #pragma region Height map struct diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index f06bc7eaaf..47b95fada7 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -14,15 +14,15 @@ *****************************************************************************/ #pragma endregion +#include "../cheats.h" #include "../network/network.h" #include "../OpenRCT2.h" - +#include "../ride/TrackDesign.h" #include "footpath.h" -#include "scenery.h" #include "map.h" #include "park.h" -#include "../cheats.h" -#include "../ride/TrackDesign.h" +#include "scenery.h" +#include "SmallScenery.h" static money32 SmallSceneryRemove(sint16 x, sint16 y, uint8 baseHeight, uint8 quadrant, uint8 sceneryType, uint8 flags) { @@ -562,4 +562,38 @@ extern "C" *ebx & 0xFF ); } + + sint32 scenery_small_get_primary_colour(const rct_tile_element * tileElement) + { + return tileElement->properties.scenery.colour_1 & TILE_ELEMENT_COLOUR_MASK; + } + + sint32 scenery_small_get_secondary_colour(const rct_tile_element * tileElement) + { + return tileElement->properties.scenery.colour_2 & TILE_ELEMENT_COLOUR_MASK; + } + + void scenery_small_set_primary_colour(rct_tile_element * tileElement, uint32 colour) + { + assert(colour <= 31); + tileElement->properties.scenery.colour_1 &= ~TILE_ELEMENT_COLOUR_MASK; + tileElement->properties.scenery.colour_1 |= colour; + } + + void scenery_small_set_secondary_colour(rct_tile_element * tileElement, uint32 colour) + { + assert(colour <= 31); + tileElement->properties.scenery.colour_2 &= ~TILE_ELEMENT_COLOUR_MASK; + tileElement->properties.scenery.colour_2 |= colour; + } + + bool scenery_small_get_supports_needed(const rct_tile_element * tileElement) + { + return (bool)(tileElement->properties.scenery.colour_1 & MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS); + } + + void scenery_small_set_supports_needed(rct_tile_element * tileElement) + { + tileElement->properties.scenery.colour_1 |= MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS; + } } diff --git a/src/openrct2/world/SmallScenery.h b/src/openrct2/world/SmallScenery.h new file mode 100644 index 0000000000..6655930a2b --- /dev/null +++ b/src/openrct2/world/SmallScenery.h @@ -0,0 +1,33 @@ +#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" +#include "map.h" + +#ifdef __cplusplus +extern "C" { +#endif + +sint32 scenery_small_get_primary_colour(const rct_tile_element * tileElement); +sint32 scenery_small_get_secondary_colour(const rct_tile_element * tileElement); +void scenery_small_set_primary_colour(rct_tile_element * tileElement, uint32 colour); +void scenery_small_set_secondary_colour(rct_tile_element * tileElement, uint32 colour); +bool scenery_small_get_supports_needed(const rct_tile_element * tileElement); +void scenery_small_set_supports_needed(rct_tile_element * tileElement); + +#ifdef __cplusplus +} +#endif diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index 252ce0d9ab..cca0d2e89c 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -23,9 +23,11 @@ #include "../localisation/string_ids.h" #include "../ride/Track.h" #include "../ride/TrackData.h" +#include "LargeScenery.h" #include "map.h" #include "park.h" #include "scenery.h" +#include "Wall.h" /** * Gets whether the given track type can have a wall placed on the edge of the given direction. @@ -549,7 +551,7 @@ static money32 WallPlace(uint8 wallType, if (wallEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR) { - tileElement->properties.wall.colour_3 = tertiaryColour; + wall_set_tertiary_colour(tileElement, tertiaryColour); } if (flags & GAME_COMMAND_FLAG_GHOST) @@ -675,7 +677,7 @@ static money32 WallSetColour(sint16 x, if (scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR) { - wallElement->properties.wall.colour_3 = tertiaryColour; + wall_set_tertiary_colour(wallElement, tertiaryColour); } map_invalidate_tile_zoom1(x, y, z, z + 72); } diff --git a/src/openrct2/world/Wall.h b/src/openrct2/world/Wall.h new file mode 100644 index 0000000000..fcf0cc2bb9 --- /dev/null +++ b/src/openrct2/world/Wall.h @@ -0,0 +1,33 @@ +#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" +#include "map.h" + +#ifdef __cplusplus +extern "C" { +#endif + +colour_t wall_get_primary_colour(const rct_tile_element * tileElement); +colour_t wall_get_secondary_colour(rct_tile_element * wallElement); +colour_t wall_get_tertiary_colour(const rct_tile_element * tileElement); +void wall_set_primary_colour(rct_tile_element * tileElement, colour_t colour); +void wall_set_secondary_colour(rct_tile_element * wallElement, colour_t secondaryColour); +void wall_set_tertiary_colour(rct_tile_element * tileElement, colour_t colour); + +#ifdef __cplusplus +} +#endif diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index 98460b479a..d1fd736eb0 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -36,11 +36,13 @@ #include "banner.h" #include "Climate.h" #include "footpath.h" +#include "LargeScenery.h" #include "map.h" #include "map_animation.h" #include "park.h" #include "scenery.h" #include "TileInspector.h" +#include "Wall.h" /** * Replaces 0x00993CCC, 0x00993CCE diff --git a/src/openrct2/world/scenery.c b/src/openrct2/world/scenery.c index 6c64dee953..7ecbfae383 100644 --- a/src/openrct2/world/scenery.c +++ b/src/openrct2/world/scenery.c @@ -325,96 +325,6 @@ sint32 get_scenery_id_from_entry_index(uint8 objectType, sint32 entryIndex) } } -sint32 scenery_small_get_primary_colour(const rct_tile_element * tileElement) -{ - return tileElement->properties.scenery.colour_1 & TILE_ELEMENT_COLOUR_MASK; -} -sint32 scenery_small_get_secondary_colour(const rct_tile_element * tileElement) -{ - return tileElement->properties.scenery.colour_2 & TILE_ELEMENT_COLOUR_MASK; -} -void scenery_small_set_primary_colour(rct_tile_element * tileElement, uint32 colour) -{ - assert(colour <= 31); - tileElement->properties.scenery.colour_1 &= ~TILE_ELEMENT_COLOUR_MASK; - tileElement->properties.scenery.colour_1 |= colour; -} -void scenery_small_set_secondary_colour(rct_tile_element * tileElement, uint32 colour) -{ - assert(colour <= 31); - tileElement->properties.scenery.colour_2 &= ~TILE_ELEMENT_COLOUR_MASK; - tileElement->properties.scenery.colour_2 |= colour; -} - -bool scenery_small_get_supports_needed(const rct_tile_element * tileElement) -{ - return (bool)(tileElement->properties.scenery.colour_1 & MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS); -} - -void scenery_small_set_supports_needed(rct_tile_element * tileElement) -{ - tileElement->properties.scenery.colour_1 |= MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS; -} - -colour_t scenery_large_get_primary_colour(const rct_tile_element * tileElement) -{ - return tileElement->properties.scenerymultiple.colour[0] & TILE_ELEMENT_COLOUR_MASK; -} - -colour_t scenery_large_get_secondary_colour(const rct_tile_element * tileElement) -{ - return tileElement->properties.scenerymultiple.colour[1] & TILE_ELEMENT_COLOUR_MASK; -} - -void scenery_large_set_primary_colour(rct_tile_element * tileElement, colour_t colour) -{ - assert(colour <= 31); - tileElement->properties.scenerymultiple.colour[0] &= ~TILE_ELEMENT_COLOUR_MASK; - tileElement->properties.scenerymultiple.colour[0] |= colour; -} - -void scenery_large_set_secondary_colour(rct_tile_element * tileElement, colour_t colour) -{ - assert(colour <= 31); - tileElement->properties.scenerymultiple.colour[1] &= ~TILE_ELEMENT_COLOUR_MASK; - tileElement->properties.scenerymultiple.colour[1] |= colour; -} - -sint32 scenery_large_get_banner_id(rct_tile_element * tileElement) -{ - return (tileElement->type & 0xC0) | - (((tileElement->properties.scenerymultiple.colour[0]) &~ TILE_ELEMENT_COLOUR_MASK) >> 2) | - (((tileElement->properties.scenerymultiple.colour[1]) &~ TILE_ELEMENT_COLOUR_MASK) >> 5); -} - -void scenery_large_set_banner_id(rct_tile_element * tileElement, uint8 bannerIndex) -{ - tileElement->type |= bannerIndex & 0xC0; - tileElement->properties.scenerymultiple.colour[0] |= (bannerIndex & 0x38) << 2; - tileElement->properties.scenerymultiple.colour[1] |= (bannerIndex & 7) << 5; -} - -sint32 scenery_large_get_type(rct_tile_element * tileElement) -{ - return (tileElement->properties.scenerymultiple.type & TILE_ELEMENT_LARGE_TYPE_MASK); -} - -sint32 scenery_large_get_sequence(rct_tile_element * tileElement) -{ - return (tileElement->properties.scenerymultiple.type >> 10); -} - -void scenery_large_set_type(rct_tile_element * tileElement, uint16 type) -{ - tileElement->properties.scenerymultiple.type &= ~TILE_ELEMENT_LARGE_TYPE_MASK; - tileElement->properties.scenerymultiple.type |= (type & TILE_ELEMENT_LARGE_TYPE_MASK); -} - -void scenery_large_set_sequence(rct_tile_element * tileElement, uint16 sequence) -{ - tileElement->properties.scenerymultiple.type &= TILE_ELEMENT_LARGE_TYPE_MASK; - tileElement->properties.scenerymultiple.type |= (sequence << 10); -} diff --git a/src/openrct2/world/scenery.h b/src/openrct2/world/scenery.h index 7f64d33045..9c6cdf60de 100644 --- a/src/openrct2/world/scenery.h +++ b/src/openrct2/world/scenery.h @@ -312,31 +312,6 @@ rct_scenery_group_entry *get_scenery_group_entry(sint32 entryIndex); sint32 get_scenery_id_from_entry_index(uint8 objectType, sint32 entryIndex); -sint32 scenery_small_get_primary_colour(const rct_tile_element * tileElement); -sint32 scenery_small_get_secondary_colour(const rct_tile_element * tileElement); -void scenery_small_set_primary_colour(rct_tile_element * tileElement, uint32 colour); -void scenery_small_set_secondary_colour(rct_tile_element * tileElement, uint32 colour); -bool scenery_small_get_supports_needed(const rct_tile_element * tileElement); -void scenery_small_set_supports_needed(rct_tile_element * tileElement); - -colour_t scenery_large_get_primary_colour(const rct_tile_element * tileElement); -colour_t scenery_large_get_secondary_colour(const rct_tile_element * tileElement); -void scenery_large_set_primary_colour(rct_tile_element * tileElement, colour_t colour); -void scenery_large_set_secondary_colour(rct_tile_element * tileElement, colour_t colour); -sint32 scenery_large_get_banner_id(rct_tile_element * tileElement); -void scenery_large_set_banner_id(rct_tile_element * tileElement, uint8 bannerIndex); -sint32 scenery_large_get_type(rct_tile_element * tileElement); -sint32 scenery_large_get_sequence(rct_tile_element * tileElement); -void scenery_large_set_type(rct_tile_element * tileElement, uint16 type); -void scenery_large_set_sequence(rct_tile_element * tileElement, uint16 sequence); - -colour_t wall_get_primary_colour(const rct_tile_element * tileElement); -colour_t wall_get_secondary_colour(rct_tile_element * wallElement); -colour_t wall_get_tertiary_colour(const rct_tile_element * tileElement); -void wall_set_primary_colour(rct_tile_element * tileElement, colour_t colour); -void wall_set_secondary_colour(rct_tile_element * wallElement, colour_t secondaryColour); -void wall_set_tertiary_colour(rct_tile_element * tileElement, colour_t colour); - #ifdef __cplusplus } #endif