diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp index 2bd2d575c3..8f316c5e30 100644 --- a/src/openrct2-ui/interface/LandTool.cpp +++ b/src/openrct2-ui/interface/LandTool.cpp @@ -71,7 +71,7 @@ void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, ui gDropdownItemsArgs[itemIndex] = surfaceObj->IconImageId; if (surfaceObj->Colour != 255) { - gDropdownItemsArgs[itemIndex] |= surfaceObj->Colour << 19 | IMAGE_TYPE_REMAP; + gDropdownItemsArgs[itemIndex] |= SPRITE_ID_PALETTE_COLOUR_1(surfaceObj->Colour); } if (i == currentSurfaceType) { diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index aec1ed4615..7bd117f250 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -951,7 +951,7 @@ static void window_footpath_start_bridge_at_point(const ScreenCoordsXY& screenCo _window_footpath_provisional_path_arrow_timer = 0; gFootpathConstructSlope = 0; gFootpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL; - gFootpathConstructValidDirections = 255; + gFootpathConstructValidDirections = INVALID_DIRECTION; window_footpath_set_enabled_and_pressed_widgets(); } @@ -977,7 +977,7 @@ static void window_footpath_construct() if (gFootpathConstructSlope == 0) { - gFootpathConstructValidDirections = 0xFF; + gFootpathConstructValidDirections = INVALID_DIRECTION; } else { @@ -1049,7 +1049,7 @@ static void footpath_remove_tile_element(TileElement* tileElement) gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y; gFootpathConstructFromPosition.z = z; gFootpathConstructDirection = edge; - gFootpathConstructValidDirections = 255; + gFootpathConstructValidDirections = INVALID_DIRECTION; } /** @@ -1179,7 +1179,7 @@ static void window_footpath_set_enabled_and_pressed_widgets() // Enable / disable directional widgets direction = gFootpathConstructValidDirections; - if (direction != 255) + if (direction != INVALID_DIRECTION) { disabledWidgets |= (1 << WIDX_DIRECTION_NW) | (1 << WIDX_DIRECTION_NE) | (1 << WIDX_DIRECTION_SW) | (1 << WIDX_DIRECTION_SE); diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 2b23dd928e..247a546186 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -305,7 +305,7 @@ static void window_land_invalidate(rct_window* w) surfaceImage = surfaceObj->IconImageId; if (surfaceObj->Colour != 255) { - surfaceImage |= surfaceObj->Colour << 19 | IMAGE_TYPE_REMAP; + surfaceImage |= SPRITE_ID_PALETTE_COLOUR_1(surfaceObj->Colour); } } const auto edgeObj = static_cast( diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index f090751d6d..0832decf29 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -745,7 +745,7 @@ static void window_mapgen_base_invalidate(rct_window* w) surfaceImage = surfaceObj->IconImageId; if (surfaceObj->Colour != 255) { - surfaceImage |= surfaceObj->Colour << 19 | IMAGE_TYPE_REMAP; + surfaceImage |= SPRITE_ID_PALETTE_COLOUR_1(surfaceObj->Colour); } } const auto edgeObj = static_cast(objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_EDGE, _wallTexture)); @@ -1048,7 +1048,7 @@ static void window_mapgen_simplex_invalidate(rct_window* w) surfaceImage = surfaceObj->IconImageId; if (surfaceObj->Colour != 255) { - surfaceImage |= surfaceObj->Colour << 19 | IMAGE_TYPE_REMAP; + surfaceImage |= SPRITE_ID_PALETTE_COLOUR_1(surfaceObj->Colour); } } const auto edgeObj = static_cast(objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_EDGE, _wallTexture)); diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index de57947645..2ea00e34f4 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -366,7 +366,7 @@ static void window_maze_construction_entrance_tooldown(const ScreenCoordsXY& scr if (entranceOrExitCoords.isNull()) return; - if (gRideEntranceExitPlaceDirection == 0xFF) + if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) return; ride_id_t rideIndex = gRideEntranceExitPlaceRideIndex; diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index d57ee47611..e4c8572362 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -3673,7 +3673,7 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; CoordsXYZD entranceOrExitCoords = ride_get_entrance_or_exit_position_from_screen_position(screenCoords); - if (gRideEntranceExitPlaceDirection == 255) + if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) { ride_construction_invalidate_current_track(); return; @@ -3914,7 +3914,7 @@ static void ride_construction_tooldown_entrance_exit(const ScreenCoordsXY& scree gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; CoordsXYZD entranceOrExitCoords = ride_get_entrance_or_exit_position_from_screen_position(screenCoords); - if (gRideEntranceExitPlaceDirection == 255) + if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION) return; auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction( diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index c3227df30c..77b4280e5c 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -237,7 +237,7 @@ private: newPeep->pathfind_goal.x = 0xFF; newPeep->pathfind_goal.y = 0xFF; newPeep->pathfind_goal.z = 0xFF; - newPeep->pathfind_goal.direction = 0xFF; + newPeep->pathfind_goal.direction = INVALID_DIRECTION; uint8_t colour = staff_get_colour(_staffType); newPeep->tshirt_colour = colour; diff --git a/src/openrct2/object/TerrainSurfaceObject.cpp b/src/openrct2/object/TerrainSurfaceObject.cpp index 6c6c618bfd..a79b0fd600 100644 --- a/src/openrct2/object/TerrainSurfaceObject.cpp +++ b/src/openrct2/object/TerrainSurfaceObject.cpp @@ -51,7 +51,7 @@ void TerrainSurfaceObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, in uint32_t imageId = GetImageId({}, 1, 0, 0, false, false); if (Colour != 255) { - imageId |= Colour << 19 | IMAGE_TYPE_REMAP; + imageId |= SPRITE_ID_PALETTE_COLOUR_1(Colour); } int32_t x0 = 0; diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 7eb2f3f42a..39721ec3d9 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -355,9 +355,9 @@ void virtual_floor_paint(paint_session* session) } } - uint32_t remap_base = COLOUR_DARK_PURPLE << 19 | IMAGE_TYPE_REMAP; - uint32_t remap_edge = COLOUR_WHITE << 19 | IMAGE_TYPE_REMAP; - uint32_t remap_lit = COLOUR_DARK_BROWN << 19 | IMAGE_TYPE_REMAP; + uint32_t remap_base = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_DARK_PURPLE); + uint32_t remap_edge = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_WHITE); + uint32_t remap_lit = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_DARK_BROWN); // Edges which are internal to objects (i.e., the tile on both sides // is occupied/lit) are not rendered to provide visual clarity. diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index e09e646f24..9b4e8e646f 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -315,7 +315,7 @@ static uint32_t get_surface_image( { session->MapPosition.x >> 5, session->MapPosition.y >> 5 }, grassLength, rotation, offset, grid, underground); if (obj->Colour != 255) { - image |= obj->Colour << 19 | IMAGE_TYPE_REMAP; + image |= SPRITE_ID_PALETTE_COLOUR_1(obj->Colour); } } return image; @@ -330,7 +330,7 @@ static uint32_t get_surface_pattern(uint8_t index, int32_t offset) image = obj->PatternBaseImageId + offset; if (obj->Colour != 255) { - image |= obj->Colour << 19 | IMAGE_TYPE_REMAP; + image |= SPRITE_ID_PALETTE_COLOUR_1(obj->Colour); } } return image; diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index 1a84a6f388..b15670faff 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -171,7 +171,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons } int32_t primaryColour = tile_element->AsWall()->GetPrimaryColour(); - uint32_t imageColourFlags = primaryColour << 19 | IMAGE_TYPE_REMAP; + uint32_t imageColourFlags = SPRITE_ID_PALETTE_COLOUR_1(primaryColour); uint32_t dword_141F718 = imageColourFlags + 0x23800006; if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 13bf14a5dd..9cf19e6a3e 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1749,7 +1749,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->pathfind_goal.x = 0xFF; peep->pathfind_goal.y = 0xFF; peep->pathfind_goal.z = 0xFF; - peep->pathfind_goal.direction = 0xFF; + peep->pathfind_goal.direction = INVALID_DIRECTION; peep->item_standard_flags = 0; peep->item_extra_flags = 0; peep->guest_heading_to_ride_id = RIDE_ID_NULL; @@ -3196,7 +3196,7 @@ void peep_reset_pathfind_goal(Peep* peep) peep->pathfind_goal.x = 0xFF; peep->pathfind_goal.y = 0xFF; peep->pathfind_goal.z = 0xFF; - peep->pathfind_goal.direction = 0xFF; + peep->pathfind_goal.direction = INVALID_DIRECTION; } /** diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 052d6d25cc..1db63bd1bf 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -616,7 +616,7 @@ static bool staff_path_finding_handyman(Peep* peep) { peep->staff_mowing_timeout++; - uint8_t litterDirection = 0xFF; + uint8_t litterDirection = INVALID_DIRECTION; uint8_t validDirections = staff_get_valid_patrol_directions(peep, peep->NextLoc.x, peep->NextLoc.y); if ((peep->staff_orders & STAFF_ORDERS_SWEEPING) && ((gCurrentTicks + peep->sprite_index) & 0xFFF) > 110) @@ -625,7 +625,7 @@ static bool staff_path_finding_handyman(Peep* peep) } Direction direction = INVALID_DIRECTION; - if (litterDirection == 0xFF && (peep->staff_orders & STAFF_ORDERS_MOWING) && peep->staff_mowing_timeout >= 12) + if (litterDirection == INVALID_DIRECTION && (peep->staff_orders & STAFF_ORDERS_MOWING) && peep->staff_mowing_timeout >= 12) { direction = staff_handyman_direction_to_uncut_grass(peep, validDirections); } @@ -651,7 +651,7 @@ static bool staff_path_finding_handyman(Peep* peep) else { bool chooseRandom = true; - if (litterDirection != 0xFF && pathDirections & (1 << litterDirection)) + if (litterDirection != INVALID_DIRECTION && pathDirections & (1 << litterDirection)) { if ((scenario_rand() & 0xFFFF) >= 0x1999) { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 60a62b308a..5316fd5143 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1529,7 +1529,7 @@ private: dst->pathfind_goal.x = 0xFF; dst->pathfind_goal.y = 0xFF; dst->pathfind_goal.z = 0xFF; - dst->pathfind_goal.direction = 0xFF; + dst->pathfind_goal.direction = INVALID_DIRECTION; // Guests' favourite ride was only saved in LL. // Set it to N/A if the save comes from the original or AA. diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index f17d8789cf..5158f8201c 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -119,7 +119,7 @@ uint8_t gRideEntranceExitPlaceType; ride_id_t gRideEntranceExitPlaceRideIndex; uint8_t gRideEntranceExitPlaceStationIndex; uint8_t gRideEntranceExitPlacePreviousRideConstructionState; -uint8_t gRideEntranceExitPlaceDirection; +Direction gRideEntranceExitPlaceDirection; uint8_t gLastEntranceStyle; @@ -1091,7 +1091,7 @@ void ride_remove_peeps(Ride* ride) int32_t exitX = 0; int32_t exitY = 0; int32_t exitZ = 0; - int32_t exitDirection = 255; + int32_t exitDirection = INVALID_DIRECTION; if (stationIndex != -1) { TileCoordsXYZD location = ride_get_exit_location(ride, stationIndex); @@ -1130,7 +1130,7 @@ void ride_remove_peeps(Ride* ride) peep->Invalidate(); - if (exitDirection == 255) + if (exitDirection == INVALID_DIRECTION) { CoordsXYZ newLoc = { peep->NextLoc.ToTileCentre(), peep->NextLoc.z }; if (peep->GetNextIsSloped()) @@ -6145,7 +6145,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC Ride* ride; CoordsXYZD entranceExitCoords{}; - gRideEntranceExitPlaceDirection = 255; + gRideEntranceExitPlaceDirection = INVALID_DIRECTION; CoordsXY unusedCoords; get_map_coordinates_from_pos(screenCoords, 0xFFFB, unusedCoords, &interactionType, &tileElement, &viewport); if (interactionType != 0) @@ -6256,7 +6256,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC } entranceExitCoords.direction = (entranceExitCoords.direction + 1) & 3; } - gRideEntranceExitPlaceDirection = 0xFF; + gRideEntranceExitPlaceDirection = INVALID_DIRECTION; } else { @@ -6879,14 +6879,14 @@ void sub_6CB945(Ride* ride) CoordsXYZ location = { ride->stations[stationId].Start.x * 32, ride->stations[stationId].Start.y * 32, ride->stations[stationId].GetBaseZ() }; auto tileHeight = TileCoordsXYZ(location).z; - uint8_t direction = 0xFF; + uint8_t direction = INVALID_DIRECTION; bool specialTrack = false; TileElement* tileElement = nullptr; while (true) { - if (direction != 0xFF) + if (direction != INVALID_DIRECTION) { location.x -= CoordsDirectionDelta[direction].x; location.y -= CoordsDirectionDelta[direction].y;