1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Pass paint session to path_paint

This commit is contained in:
Ted John
2017-09-02 22:31:39 +01:00
parent 47521335fa
commit 4c78827c45
4 changed files with 32 additions and 33 deletions

View File

@@ -250,7 +250,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
surface_paint(session, direction, height, map_element); surface_paint(session, direction, height, map_element);
break; break;
case MAP_ELEMENT_TYPE_PATH: case MAP_ELEMENT_TYPE_PATH:
path_paint(direction, height, map_element); path_paint(session, direction, height, map_element);
break; break;
case MAP_ELEMENT_TYPE_TRACK: case MAP_ELEMENT_TYPE_TRACK:
track_paint(direction, height, map_element); track_paint(direction, height, map_element);

View File

@@ -99,7 +99,7 @@ void map_element_paint_setup(paint_session * session, sint32 x, sint32 y);
void entrance_paint(uint8 direction, sint32 height, rct_map_element* map_element); void entrance_paint(uint8 direction, sint32 height, rct_map_element* map_element);
void banner_paint(uint8 direction, sint32 height, rct_map_element* map_element); void banner_paint(uint8 direction, sint32 height, rct_map_element* map_element);
void surface_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element *mapElement); void surface_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element *mapElement);
void path_paint(uint8 direction, uint16 height, rct_map_element *mapElement); void path_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element *mapElement);
void scenery_paint(uint8 direction, sint32 height, rct_map_element* mapElement); void scenery_paint(uint8 direction, sint32 height, rct_map_element* mapElement);
void fence_paint(uint8 direction, sint32 height, rct_map_element* mapElement); void fence_paint(uint8 direction, sint32 height, rct_map_element* mapElement);
void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *mapElement); void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *mapElement);

View File

@@ -82,9 +82,8 @@ const uint8 byte_98D8A4[] = {
0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0
}; };
void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags); void path_paint_pole_support(paint_session * session, rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
void path_paint_box_support(paint_session * session, rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
/* rct2: 0x006A5AE5 */ /* rct2: 0x006A5AE5 */
static void path_bit_lights_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags) { static void path_bit_lights_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags) {
@@ -285,7 +284,7 @@ static void path_bit_jumping_fountains_paint(rct_scenery_entry* pathBitEntry, rc
* @param ebp (ebp) * @param ebp (ebp)
* @param base_image_id (0x00F3EF78) * @param base_image_id (0x00F3EF78)
*/ */
static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp, bool word_F3F038, rct_footpath_entry * footpathEntry, uint32 base_image_id, uint32 imageFlags) static void sub_6A4101(paint_session * session, rct_map_element * map_element, uint16 height, uint32 ebp, bool word_F3F038, rct_footpath_entry * footpathEntry, uint32 base_image_id, uint32 imageFlags)
{ {
if (footpath_element_is_queue(map_element)) { if (footpath_element_is_queue(map_element)) {
uint8 local_ebp = ebp & 0x0F; uint8 local_ebp = ebp & 0x0F;
@@ -366,7 +365,7 @@ static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp,
uint8 direction = ((map_element->type & 0xC0) >> 6); uint8 direction = ((map_element->type & 0xC0) >> 6);
// Draw ride sign // Draw ride sign
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
if (footpath_element_is_sloped(map_element)) { if (footpath_element_is_sloped(map_element)) {
if (footpath_element_get_slope_direction(map_element) == direction) if (footpath_element_get_slope_direction(map_element) == direction)
height += 16; height += 16;
@@ -419,9 +418,9 @@ static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp,
sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation()); sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation());
} }
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH; session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
if (imageFlags != 0) { if (imageFlags != 0) {
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
} }
return; return;
} }
@@ -583,7 +582,7 @@ static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp,
* @param imageFlags (0x00F3EF70) * @param imageFlags (0x00F3EF70)
* @param sceneryImageFlags (0x00F3EF74) * @param sceneryImageFlags (0x00F3EF74)
*/ */
static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height, rct_footpath_entry * footpathEntry, uint32 imageFlags, uint32 sceneryImageFlags, bool word_F3F038) static void sub_6A3F61(paint_session * session, rct_map_element * map_element, uint16 bp, uint16 height, rct_footpath_entry * footpathEntry, uint32 imageFlags, uint32 sceneryImageFlags, bool word_F3F038)
{ {
// eax -- // eax --
// ebx -- // ebx --
@@ -596,15 +595,15 @@ static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height,
// Probably drawing benches etc. // Probably drawing benches etc.
rct_drawpixelinfo * dpi = gPaintSession.Unk140E9A8; rct_drawpixelinfo * dpi = session->Unk140E9A8;
if (dpi->zoom_level <= 1) { if (dpi->zoom_level <= 1) {
if (!gTrackDesignSaveMode) { if (!gTrackDesignSaveMode) {
uint8 additions = map_element->properties.path.additions & 0xF; uint8 additions = map_element->properties.path.additions & 0xF;
if (additions != 0) { if (additions != 0) {
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM; session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM;
if (sceneryImageFlags != 0) { if (sceneryImageFlags != 0) {
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
} }
// Draw additional path bits (bins, benches, lamps, queue screens) // Draw additional path bits (bins, benches, lamps, queue screens)
@@ -624,17 +623,17 @@ static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height,
break; break;
} }
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH; session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
if (sceneryImageFlags != 0) { if (sceneryImageFlags != 0) {
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
} }
} }
} }
// Redundant zoom-level check removed // Redundant zoom-level check removed
sub_6A4101(map_element, height, bp, word_F3F038, footpathEntry, footpathEntry->image | imageFlags, imageFlags); sub_6A4101(session, map_element, height, bp, word_F3F038, footpathEntry, footpathEntry->image | imageFlags, imageFlags);
} }
// This is about tunnel drawing // This is about tunnel drawing
@@ -670,9 +669,9 @@ static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height,
/** /**
* rct2: 0x0006A3590 * rct2: 0x0006A3590
*/ */
void path_paint(uint8 direction, uint16 height, rct_map_element * map_element) void path_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element * map_element)
{ {
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH; session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
bool word_F3F038 = false; bool word_F3F038 = false;
@@ -696,11 +695,11 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
} }
if (map_element->flags & MAP_ELEMENT_FLAG_GHOST) { if (map_element->flags & MAP_ELEMENT_FLAG_GHOST) {
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
imageFlags = construction_markers[gConfigGeneral.construction_marker_colour]; imageFlags = construction_markers[gConfigGeneral.construction_marker_colour];
} }
sint16 x = gPaintSession.MapPosition.x, y = gPaintSession.MapPosition.y; sint16 x = session->MapPosition.x, y = session->MapPosition.y;
rct_map_element * surface = map_get_surface_element_at(x / 32, y / 32); rct_map_element * surface = map_get_surface_element_at(x / 32, y / 32);
@@ -727,8 +726,8 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
sint32 staffIndex = gStaffDrawPatrolAreas; sint32 staffIndex = gStaffDrawPatrolAreas;
uint8 staffType = staffIndex & 0x7FFF; uint8 staffType = staffIndex & 0x7FFF;
bool is_staff_list = staffIndex & 0x8000; bool is_staff_list = staffIndex & 0x8000;
x = gPaintSession.MapPosition.x; x = session->MapPosition.x;
y = gPaintSession.MapPosition.y; y = session->MapPosition.y;
uint8 patrolColour = COLOUR_LIGHT_BLUE; uint8 patrolColour = COLOUR_LIGHT_BLUE;
@@ -769,10 +768,10 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
if (footpathEntry != (void*)-1) { if (footpathEntry != (void*)-1) {
if (footpathEntry->support_type == FOOTPATH_ENTRY_SUPPORT_TYPE_POLE) { if (footpathEntry->support_type == FOOTPATH_ENTRY_SUPPORT_TYPE_POLE) {
path_paint_pole_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags); path_paint_pole_support(session, map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
} }
else { else {
path_paint_box_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags); path_paint_box_support(session, map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
} }
} }
@@ -799,7 +798,7 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
#endif #endif
} }
void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags) void path_paint_pole_support(paint_session * session, rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
{ {
// Rol edges around rotation // Rol edges around rotation
uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) | uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) |
@@ -826,14 +825,14 @@ void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_fo
imageId += 51; imageId += 51;
} }
if (!gPaintSession.DidPassSurface) { if (!session->DidPassSurface) {
boundBoxOffset.x = 3; boundBoxOffset.x = 3;
boundBoxOffset.y = 3; boundBoxOffset.y = 3;
boundBoxSize.x = 26; boundBoxSize.x = 26;
boundBoxSize.y = 26; boundBoxSize.y = 26;
} }
if (!hasFences || !gPaintSession.DidPassSurface) { if (!hasFences || !session->DidPassSurface) {
sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation()); sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
} else { } else {
uint32 image_id; uint32 image_id;
@@ -853,7 +852,7 @@ void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_fo
} }
sub_6A3F61(mapElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences); sub_6A3F61(session, mapElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences);
uint16 ax = 0; uint16 ax = 0;
if (footpath_element_is_sloped(mapElement)) { if (footpath_element_is_sloped(mapElement)) {
@@ -904,7 +903,7 @@ void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_fo
} }
} }
void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags) void path_paint_box_support(paint_session * session, rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
{ {
// Rol edges around rotation // Rol edges around rotation
uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) | uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) |
@@ -940,14 +939,14 @@ void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_foot
} }
// Below Surface // Below Surface
if (!gPaintSession.DidPassSurface) { if (!session->DidPassSurface) {
boundBoxOffset.x = 3; boundBoxOffset.x = 3;
boundBoxOffset.y = 3; boundBoxOffset.y = 3;
boundBoxSize.x = 26; boundBoxSize.x = 26;
boundBoxSize.y = 26; boundBoxSize.y = 26;
} }
if (!hasFences || !gPaintSession.DidPassSurface) { if (!hasFences || !session->DidPassSurface) {
sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation()); sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
} }
else { else {
@@ -967,7 +966,7 @@ void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_foot
} }
} }
sub_6A3F61(mapElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences); // TODO: arguments sub_6A3F61(session, mapElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences); // TODO: arguments
uint16 ax = 0; uint16 ax = 0;
if (footpath_element_is_sloped(mapElement)) { if (footpath_element_is_sloped(mapElement)) {

View File

@@ -83,7 +83,7 @@ uint8 gMapSelectArrowDirection;
void entrance_paint(uint8 direction, int height, rct_map_element *map_element) { } void entrance_paint(uint8 direction, int height, rct_map_element *map_element) { }
void banner_paint(uint8 direction, int height, rct_map_element *map_element) { } void banner_paint(uint8 direction, int height, rct_map_element *map_element) { }
void surface_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element *mapElement) { } void surface_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element *mapElement) { }
void path_paint(uint8 direction, uint16 height, rct_map_element *mapElement) { } void path_paint(paint_session * session, uint8 direction, uint16 height, rct_map_element *mapElement) { }
void scenery_paint(uint8 direction, int height, rct_map_element *mapElement) { } void scenery_paint(uint8 direction, int height, rct_map_element *mapElement) { }
void fence_paint(uint8 direction, int height, rct_map_element *mapElement) { } void fence_paint(uint8 direction, int height, rct_map_element *mapElement) { }
void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *mapElement) { } void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *mapElement) { }