mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 10:15:36 +01:00
Add virtual floor painting functions.
This commit is contained in:
committed by
Aaron van Geffen
parent
19d35e6898
commit
128cff60db
@@ -17,6 +17,7 @@
|
||||
#include "../../config/Config.h"
|
||||
#include "../../core/Math.hpp"
|
||||
#include "../../drawing/Drawing.h"
|
||||
#include "../../Input.h"
|
||||
#include "../../Game.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../localisation/Localisation.h"
|
||||
@@ -31,9 +32,9 @@
|
||||
#include "../../sprites.h"
|
||||
#include "../Paint.h"
|
||||
#include "../Supports.h"
|
||||
#include "Surface.h"
|
||||
#include "TileElement.h"
|
||||
|
||||
|
||||
#ifdef __TESTPAINT__
|
||||
uint16 testPaintVerticalTunnelHeight;
|
||||
#endif
|
||||
@@ -316,6 +317,8 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
|
||||
session->MapPosition = dword_9DE574;
|
||||
} while (!tile_element_is_last_for_tile(tile_element++));
|
||||
|
||||
virtual_floor_paint(session);
|
||||
|
||||
if (!gShowSupportSegmentHeights) {
|
||||
return;
|
||||
}
|
||||
@@ -355,6 +358,64 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
|
||||
}
|
||||
}
|
||||
|
||||
void virtual_floor_paint(paint_session * session)
|
||||
{
|
||||
if (!input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool showFade = false;
|
||||
bool showLit = false;
|
||||
|
||||
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) &&
|
||||
session->MapPosition.x >= gMapSelectPositionA.x - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y >= gMapSelectPositionA.y - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.x <= gMapSelectPositionB.x + gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y <= gMapSelectPositionB.y + gMapVirtualFloorBaseSize)
|
||||
{
|
||||
showFade = true;
|
||||
}
|
||||
|
||||
if (!showFade && !(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LocationXY16 * tile;
|
||||
for (tile = gMapSelectionTiles; tile->x != -1; tile++) {
|
||||
if (session->MapPosition.x >= tile->x - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y >= tile->y - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.x <= tile->x + gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y <= tile->y + gMapVirtualFloorBaseSize)
|
||||
{
|
||||
showFade = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!showFade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (tile = gMapSelectionTiles; tile->x != -1; tile++) {
|
||||
if (session->MapPosition.x == tile->x &&
|
||||
session->MapPosition.y == tile->y)
|
||||
{
|
||||
showLit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
uint32 image_id = SPR_TERRAIN_SELECTION_SQUARE | COLOUR_GREY << 24 | COLOUR_DARK_PURPLE << 19 | IMAGE_TYPE_REMAP;
|
||||
if (showLit)
|
||||
{
|
||||
image_id = SPR_TERRAIN_SELECTION_PATROL_AREA | COLOUR_YELLOW << 19 | IMAGE_TYPE_REMAP;
|
||||
}
|
||||
sub_98196C(session, image_id, 0, 0, 10, 10, -1, gMapVirtualFloorHeight, get_current_rotation());
|
||||
}
|
||||
|
||||
void paint_util_push_tunnel_left(paint_session * session, uint16 height, uint8 type)
|
||||
{
|
||||
session->LeftTunnels[session->LeftTunnelCount] = {static_cast<uint8>((height / 16)), type};
|
||||
|
||||
@@ -109,6 +109,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_
|
||||
void fence_paint(paint_session * session, uint8 direction, sint32 height, rct_tile_element* tileElement);
|
||||
void large_scenery_paint(paint_session * session, uint8 direction, uint16 height, rct_tile_element *tileElement);
|
||||
void track_paint(paint_session * session, uint8 direction, sint32 height, rct_tile_element *tileElement);
|
||||
void virtual_floor_paint(paint_session * session);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "../interface/Window.h"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../Input.h"
|
||||
#include "../management/Finance.h"
|
||||
#include "../network/network.h"
|
||||
#include "../OpenRCT2.h"
|
||||
@@ -85,6 +86,9 @@ LocationXY16 gMapSelectPositionB;
|
||||
LocationXYZ16 gMapSelectArrowPosition;
|
||||
uint8 gMapSelectArrowDirection;
|
||||
|
||||
uint16 gMapVirtualFloorBaseSize = 5*32;
|
||||
uint16 gMapVirtualFloorHeight;
|
||||
|
||||
uint8 gMapGroundFlags;
|
||||
|
||||
uint16 gWidePathTileLoopX;
|
||||
@@ -4729,3 +4733,17 @@ uint8 tile_element_get_ride_index(const rct_tile_element * tileElement)
|
||||
return 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void map_set_virtual_floor_height(sint16 height)
|
||||
{
|
||||
if (gMapVirtualFloorHeight != height && input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z))
|
||||
{
|
||||
map_invalidate_virtual_floor_tiles();
|
||||
}
|
||||
|
||||
gMapVirtualFloorHeight = height;
|
||||
}
|
||||
|
||||
void map_invalidate_virtual_floor_tiles()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -383,6 +383,9 @@ extern LocationXY16 gMapSelectPositionB;
|
||||
extern LocationXYZ16 gMapSelectArrowPosition;
|
||||
extern uint8 gMapSelectArrowDirection;
|
||||
|
||||
extern uint16 gMapVirtualFloorHeight;
|
||||
extern uint16 gMapVirtualFloorBaseSize;
|
||||
|
||||
extern uint8 gMapGroundFlags;
|
||||
|
||||
extern rct_tile_element gTileElements[];
|
||||
@@ -456,6 +459,8 @@ void map_reorganise_elements();
|
||||
bool map_check_free_elements_and_reorganise(sint32 num_elements);
|
||||
rct_tile_element *tile_element_insert(sint32 x, sint32 y, sint32 z, sint32 flags);
|
||||
bool tile_element_check_address(const rct_tile_element * const element);
|
||||
void map_set_virtual_floor_height(sint16 height);
|
||||
void map_invalidate_virtual_floor_tiles();
|
||||
|
||||
typedef sint32 (CLEAR_FUNC)(rct_tile_element** tile_element, sint32 x, sint32 y, uint8 flags, money32* price);
|
||||
sint32 map_place_non_scenery_clear_func(rct_tile_element** tile_element, sint32 x, sint32 y, uint8 flags, money32* price);
|
||||
|
||||
Reference in New Issue
Block a user