diff --git a/src/openrct2/ride/coaster/air_powered_vertical_coaster.c b/src/openrct2/ride/coaster/air_powered_vertical_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/air_powered_vertical_coaster.c rename to src/openrct2/ride/coaster/air_powered_vertical_coaster.cpp diff --git a/src/openrct2/ride/coaster/bobsleigh_coaster.c b/src/openrct2/ride/coaster/bobsleigh_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/bobsleigh_coaster.c rename to src/openrct2/ride/coaster/bobsleigh_coaster.cpp diff --git a/src/openrct2/ride/coaster/bolliger_mabillard_track.c b/src/openrct2/ride/coaster/bolliger_mabillard_track.cpp similarity index 100% rename from src/openrct2/ride/coaster/bolliger_mabillard_track.c rename to src/openrct2/ride/coaster/bolliger_mabillard_track.cpp diff --git a/src/openrct2/ride/coaster/compact_inverted_coaster.c b/src/openrct2/ride/coaster/compact_inverted_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/compact_inverted_coaster.c rename to src/openrct2/ride/coaster/compact_inverted_coaster.cpp diff --git a/src/openrct2/ride/coaster/corkscrew_roller_coaster.c b/src/openrct2/ride/coaster/corkscrew_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/corkscrew_roller_coaster.c rename to src/openrct2/ride/coaster/corkscrew_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/flying_roller_coaster.c b/src/openrct2/ride/coaster/flying_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/flying_roller_coaster.c rename to src/openrct2/ride/coaster/flying_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/giga_coaster.c b/src/openrct2/ride/coaster/giga_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/giga_coaster.c rename to src/openrct2/ride/coaster/giga_coaster.cpp diff --git a/src/openrct2/ride/coaster/heartline_twister_coaster.c b/src/openrct2/ride/coaster/heartline_twister_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/heartline_twister_coaster.c rename to src/openrct2/ride/coaster/heartline_twister_coaster.cpp diff --git a/src/openrct2/ride/coaster/inverted_hairpin_coaster.c b/src/openrct2/ride/coaster/inverted_hairpin_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/inverted_hairpin_coaster.c rename to src/openrct2/ride/coaster/inverted_hairpin_coaster.cpp diff --git a/src/openrct2/ride/coaster/inverted_impulse_coaster.c b/src/openrct2/ride/coaster/inverted_impulse_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/inverted_impulse_coaster.c rename to src/openrct2/ride/coaster/inverted_impulse_coaster.cpp diff --git a/src/openrct2/ride/coaster/inverted_roller_coaster.c b/src/openrct2/ride/coaster/inverted_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/inverted_roller_coaster.c rename to src/openrct2/ride/coaster/inverted_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/junior_roller_coaster.c b/src/openrct2/ride/coaster/junior_roller_coaster.cpp similarity index 99% rename from src/openrct2/ride/coaster/junior_roller_coaster.c rename to src/openrct2/ride/coaster/junior_roller_coaster.cpp index 09276634c2..5c08f30b76 100644 --- a/src/openrct2/ride/coaster/junior_roller_coaster.c +++ b/src/openrct2/ride/coaster/junior_roller_coaster.cpp @@ -27,6 +27,7 @@ #include "../ride_data.h" #include "../track_data.h" #include "../track_paint.h" +#include "../../core/Math.hpp" enum { SPR_JUNIOR_RC_FLAT_SW_NE = 27807, @@ -3776,7 +3777,7 @@ void junior_rc_paint_track_diag_flat_to_25_deg_up(paint_session * session, uint8 void junior_rc_paint_track_diag_flat_to_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { // There is no specific chain for the Water Coaster, use the Junior RC chain instead - chainType = min(1, chainType); + chainType = Math::Min(JUNIOR_RC_CHAIN_FRICTION_WHEELS, chainType); track_paint_util_diag_tiles_paint(session, 1, height, direction, trackSequence, session->TrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); @@ -3805,7 +3806,7 @@ void junior_rc_paint_track_diag_25_deg_up_to_flat(paint_session * session, uint8 void junior_rc_paint_track_diag_60_deg_up_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { // There is no specific chain for the Water Coaster, use the Junior RC chain instead - chainType = min(1, chainType); + chainType = Math::Min(JUNIOR_RC_CHAIN_FRICTION_WHEELS, chainType); track_paint_util_diag_tiles_paint(session, 1, height, direction, trackSequence, session->TrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_up_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); @@ -3848,7 +3849,7 @@ void junior_rc_paint_track_diag_flat_to_25_deg_down(paint_session * session, uin void junior_rc_paint_track_diag_flat_to_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { // There is no specific chain for the Water Coaster, use the Junior RC chain instead - chainType = min(1, chainType); + chainType = Math::Min(JUNIOR_RC_CHAIN_FRICTION_WHEELS, chainType); track_paint_util_diag_tiles_paint(session, 1, height, direction, trackSequence, session->TrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_60_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); @@ -3877,7 +3878,7 @@ void junior_rc_paint_track_diag_25_deg_down_to_flat(paint_session * session, uin void junior_rc_paint_track_diag_60_deg_down_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { // There is no specific chain for the Water Coaster, use the Junior RC chain instead - chainType = min(1, chainType); + chainType = Math::Min(JUNIOR_RC_CHAIN_FRICTION_WHEELS, chainType); track_paint_util_diag_tiles_paint(session, 1, height, direction, trackSequence, session->TrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); diff --git a/src/openrct2/ride/coaster/lay_down_roller_coaster.c b/src/openrct2/ride/coaster/lay_down_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/lay_down_roller_coaster.c rename to src/openrct2/ride/coaster/lay_down_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/lim_launched_roller_coaster.c b/src/openrct2/ride/coaster/lim_launched_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/lim_launched_roller_coaster.c rename to src/openrct2/ride/coaster/lim_launched_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/looping_roller_coaster.c b/src/openrct2/ride/coaster/looping_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/looping_roller_coaster.c rename to src/openrct2/ride/coaster/looping_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/mine_ride.c b/src/openrct2/ride/coaster/mine_ride.cpp similarity index 100% rename from src/openrct2/ride/coaster/mine_ride.c rename to src/openrct2/ride/coaster/mine_ride.cpp diff --git a/src/openrct2/ride/coaster/mine_train_coaster.c b/src/openrct2/ride/coaster/mine_train_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/mine_train_coaster.c rename to src/openrct2/ride/coaster/mine_train_coaster.cpp diff --git a/src/openrct2/ride/coaster/mini_roller_coaster.c b/src/openrct2/ride/coaster/mini_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/mini_roller_coaster.c rename to src/openrct2/ride/coaster/mini_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/mini_suspended_coaster.c b/src/openrct2/ride/coaster/mini_suspended_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/mini_suspended_coaster.c rename to src/openrct2/ride/coaster/mini_suspended_coaster.cpp diff --git a/src/openrct2/ride/coaster/multi_dimension_roller_coaster.c b/src/openrct2/ride/coaster/multi_dimension_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/multi_dimension_roller_coaster.c rename to src/openrct2/ride/coaster/multi_dimension_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/reverse_freefall_coaster.c b/src/openrct2/ride/coaster/reverse_freefall_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/reverse_freefall_coaster.c rename to src/openrct2/ride/coaster/reverse_freefall_coaster.cpp diff --git a/src/openrct2/ride/coaster/reverser_roller_coaster.c b/src/openrct2/ride/coaster/reverser_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/reverser_roller_coaster.c rename to src/openrct2/ride/coaster/reverser_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/side_friction_roller_coaster.c b/src/openrct2/ride/coaster/side_friction_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/side_friction_roller_coaster.c rename to src/openrct2/ride/coaster/side_friction_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/stand_up_roller_coaster.c b/src/openrct2/ride/coaster/stand_up_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/stand_up_roller_coaster.c rename to src/openrct2/ride/coaster/stand_up_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/steeplechase.c b/src/openrct2/ride/coaster/steeplechase.cpp similarity index 100% rename from src/openrct2/ride/coaster/steeplechase.c rename to src/openrct2/ride/coaster/steeplechase.cpp diff --git a/src/openrct2/ride/coaster/suspended_swinging_coaster.c b/src/openrct2/ride/coaster/suspended_swinging_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/suspended_swinging_coaster.c rename to src/openrct2/ride/coaster/suspended_swinging_coaster.cpp diff --git a/src/openrct2/ride/coaster/twister_roller_coaster.c b/src/openrct2/ride/coaster/twister_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/twister_roller_coaster.c rename to src/openrct2/ride/coaster/twister_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/vertical_drop_roller_coaster.c b/src/openrct2/ride/coaster/vertical_drop_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/vertical_drop_roller_coaster.c rename to src/openrct2/ride/coaster/vertical_drop_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/virginia_reel.c b/src/openrct2/ride/coaster/virginia_reel.cpp similarity index 99% rename from src/openrct2/ride/coaster/virginia_reel.c rename to src/openrct2/ride/coaster/virginia_reel.cpp index 20fd99e056..ccb32edf17 100644 --- a/src/openrct2/ride/coaster/virginia_reel.c +++ b/src/openrct2/ride/coaster/virginia_reel.cpp @@ -21,6 +21,7 @@ #include "../../interface/viewport.h" #include "../../paint/paint.h" #include "../../paint/supports.h" +#include "../../core/Util.hpp" // 0x009927E6: static const vehicle_boundbox _virginiaReelBoundbox[] = { @@ -218,7 +219,7 @@ void vehicle_visual_virginia_reel(paint_session * session, sint32 x, sint32 imag riding_peep_sprites[((ecx / 8) + i) & 3] = vehicle->peep_tshirt_colours[i]; } sint32 draw_order[4] = {0, 1, 3, 2}; - for (sint32 i = 0; i < countof(draw_order); i++) { + for (uint32 i = 0; i < Util::CountOf(draw_order); i++) { if (riding_peep_sprites[draw_order[i]] != 0xFF) { image_id = (baseImage_id + ((draw_order[i] + 1) * 72)) | SPRITE_ID_PALETTE_COLOUR_1(riding_peep_sprites[draw_order[i]]); sub_98199C(session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z, rotation); diff --git a/src/openrct2/ride/coaster/wild_mouse.c b/src/openrct2/ride/coaster/wild_mouse.cpp similarity index 100% rename from src/openrct2/ride/coaster/wild_mouse.c rename to src/openrct2/ride/coaster/wild_mouse.cpp diff --git a/src/openrct2/ride/coaster/wooden_roller_coaster.c b/src/openrct2/ride/coaster/wooden_roller_coaster.cpp similarity index 100% rename from src/openrct2/ride/coaster/wooden_roller_coaster.c rename to src/openrct2/ride/coaster/wooden_roller_coaster.cpp diff --git a/src/openrct2/ride/coaster/wooden_wild_mouse.c b/src/openrct2/ride/coaster/wooden_wild_mouse.cpp similarity index 100% rename from src/openrct2/ride/coaster/wooden_wild_mouse.c rename to src/openrct2/ride/coaster/wooden_wild_mouse.cpp diff --git a/src/openrct2/ride/gentle/car_ride.c b/src/openrct2/ride/gentle/car_ride.cpp similarity index 100% rename from src/openrct2/ride/gentle/car_ride.c rename to src/openrct2/ride/gentle/car_ride.cpp diff --git a/src/openrct2/ride/gentle/circus_show.c b/src/openrct2/ride/gentle/circus_show.cpp similarity index 97% rename from src/openrct2/ride/gentle/circus_show.c rename to src/openrct2/ride/gentle/circus_show.cpp index 7dee2ca082..393dbcfcd9 100644 --- a/src/openrct2/ride/gentle/circus_show.c +++ b/src/openrct2/ride/gentle/circus_show.cpp @@ -25,7 +25,7 @@ */ static void paint_circus_show_tent(paint_session * session, uint8 rideIndex, uint8 direction, sint8 al, sint8 cl, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); Ride * ride = get_ride(rideIndex); rct_ride_entry * rideEntry = get_ride_entry(ride->subtype); diff --git a/src/openrct2/ride/gentle/crooked_house.c b/src/openrct2/ride/gentle/crooked_house.cpp similarity index 97% rename from src/openrct2/ride/gentle/crooked_house.c rename to src/openrct2/ride/gentle/crooked_house.cpp index 770e38aa5e..96ee2f71b9 100644 --- a/src/openrct2/ride/gentle/crooked_house.c +++ b/src/openrct2/ride/gentle/crooked_house.cpp @@ -44,7 +44,7 @@ rct_crooked_house_bound_box crooked_house_data[] = { * @param (edx) height */ static void paint_crooked_house_structure(paint_session * session, uint8 direction, uint8 x_offset, uint8 y_offset, uint32 segment, sint32 height) { - rct_map_element *original_map_element = session->CurrentlyDrawnItem; + rct_map_element *original_map_element = static_cast(session->CurrentlyDrawnItem); Ride *ride = get_ride(original_map_element->properties.track.ride_index); diff --git a/src/openrct2/ride/gentle/dodgems.c b/src/openrct2/ride/gentle/dodgems.cpp similarity index 100% rename from src/openrct2/ride/gentle/dodgems.c rename to src/openrct2/ride/gentle/dodgems.cpp diff --git a/src/openrct2/ride/gentle/ferris_wheel.c b/src/openrct2/ride/gentle/ferris_wheel.cpp similarity index 98% rename from src/openrct2/ride/gentle/ferris_wheel.c rename to src/openrct2/ride/gentle/ferris_wheel.cpp index e62f893a2c..0e37ea1bef 100644 --- a/src/openrct2/ride/gentle/ferris_wheel.c +++ b/src/openrct2/ride/gentle/ferris_wheel.cpp @@ -58,7 +58,7 @@ static void paint_ferris_wheel_structure(paint_session * session, uint8 rideInde { uint32 imageId, baseImageId; - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); Ride * ride = get_ride(rideIndex); rct_ride_entry * rideEntry = get_ride_entry(ride->subtype); diff --git a/src/openrct2/ride/gentle/flying_saucers.c b/src/openrct2/ride/gentle/flying_saucers.cpp similarity index 100% rename from src/openrct2/ride/gentle/flying_saucers.c rename to src/openrct2/ride/gentle/flying_saucers.cpp diff --git a/src/openrct2/ride/gentle/ghost_train.c b/src/openrct2/ride/gentle/ghost_train.cpp similarity index 100% rename from src/openrct2/ride/gentle/ghost_train.c rename to src/openrct2/ride/gentle/ghost_train.cpp diff --git a/src/openrct2/ride/gentle/haunted_house.c b/src/openrct2/ride/gentle/haunted_house.cpp similarity index 98% rename from src/openrct2/ride/gentle/haunted_house.c rename to src/openrct2/ride/gentle/haunted_house.cpp index 50a6a4d748..59c6cad508 100644 --- a/src/openrct2/ride/gentle/haunted_house.c +++ b/src/openrct2/ride/gentle/haunted_house.cpp @@ -44,7 +44,7 @@ static haunted_house_bound_box haunted_house_data[] = { */ static void paint_haunted_house_structure(paint_session * session, uint8 rideIndex, uint8 direction, sint8 xOffset, sint8 yOffset, uint8 part, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); uint8 frameNum = 0; diff --git a/src/openrct2/ride/gentle/maze.c b/src/openrct2/ride/gentle/maze.cpp similarity index 100% rename from src/openrct2/ride/gentle/maze.c rename to src/openrct2/ride/gentle/maze.cpp diff --git a/src/openrct2/ride/gentle/merry_go_round.c b/src/openrct2/ride/gentle/merry_go_round.cpp similarity index 98% rename from src/openrct2/ride/gentle/merry_go_round.c rename to src/openrct2/ride/gentle/merry_go_round.cpp index f5e9babc92..d630d39e0b 100644 --- a/src/openrct2/ride/gentle/merry_go_round.c +++ b/src/openrct2/ride/gentle/merry_go_round.cpp @@ -35,7 +35,7 @@ static const uint16 merry_go_round_breakdown_vibration[] = { */ static void paint_merry_go_round_structure(paint_session * session, uint8 rideIndex, uint8 direction, sint8 xOffset, sint8 yOffset, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); height += 7; Ride * ride = get_ride(rideIndex); diff --git a/src/openrct2/ride/gentle/mini_golf.c b/src/openrct2/ride/gentle/mini_golf.cpp similarity index 98% rename from src/openrct2/ride/gentle/mini_golf.c rename to src/openrct2/ride/gentle/mini_golf.cpp index f0a0bd004e..585156661d 100644 --- a/src/openrct2/ride/gentle/mini_golf.c +++ b/src/openrct2/ride/gentle/mini_golf.cpp @@ -23,6 +23,7 @@ #include "../track_paint.h" #include "../../world/map.h" #include "../vehicle_paint.h" +#include "../../core/Util.hpp" enum { SPR_MINI_GOLF_FLAT_SW_NE = 14404, @@ -413,15 +414,15 @@ static const uint8 * mini_golf_peep_animation_frames[] = { }; const uint8 mini_golf_peep_animation_lengths[] = { - countof(mini_golf_peep_animation_frames_walk), - countof(mini_golf_peep_animation_frames_place_ball_downwards), - countof(mini_golf_peep_animation_frames_swing_left), - countof(mini_golf_peep_animation_frames_place_ball_upwards), - countof(mini_golf_peep_animation_frames_jump), - countof(mini_golf_peep_animation_frames_pickup_ball), - countof(mini_golf_peep_animation_frames_put_left), - countof(mini_golf_peep_animation_frames_swing), - countof(mini_golf_peep_animation_frames_put), + Util::CountOf(mini_golf_peep_animation_frames_walk), + Util::CountOf(mini_golf_peep_animation_frames_place_ball_downwards), + Util::CountOf(mini_golf_peep_animation_frames_swing_left), + Util::CountOf(mini_golf_peep_animation_frames_place_ball_upwards), + Util::CountOf(mini_golf_peep_animation_frames_jump), + Util::CountOf(mini_golf_peep_animation_frames_pickup_ball), + Util::CountOf(mini_golf_peep_animation_frames_put_left), + Util::CountOf(mini_golf_peep_animation_frames_swing), + Util::CountOf(mini_golf_peep_animation_frames_put), }; static paint_struct * mini_golf_paint_util_7c( diff --git a/src/openrct2/ride/gentle/mini_helicopters.c b/src/openrct2/ride/gentle/mini_helicopters.cpp similarity index 100% rename from src/openrct2/ride/gentle/mini_helicopters.c rename to src/openrct2/ride/gentle/mini_helicopters.cpp diff --git a/src/openrct2/ride/gentle/monorail_cycles.c b/src/openrct2/ride/gentle/monorail_cycles.cpp similarity index 100% rename from src/openrct2/ride/gentle/monorail_cycles.c rename to src/openrct2/ride/gentle/monorail_cycles.cpp diff --git a/src/openrct2/ride/gentle/observation_tower.c b/src/openrct2/ride/gentle/observation_tower.cpp similarity index 100% rename from src/openrct2/ride/gentle/observation_tower.c rename to src/openrct2/ride/gentle/observation_tower.cpp diff --git a/src/openrct2/ride/gentle/space_rings.c b/src/openrct2/ride/gentle/space_rings.cpp similarity index 98% rename from src/openrct2/ride/gentle/space_rings.c rename to src/openrct2/ride/gentle/space_rings.cpp index 366f20047b..5f9335416f 100644 --- a/src/openrct2/ride/gentle/space_rings.c +++ b/src/openrct2/ride/gentle/space_rings.cpp @@ -39,7 +39,7 @@ static const uint32 space_rings_fence_sprites[] = { /** rct2: 0x00768A3B */ static void paint_space_rings_structure(paint_session * session, Ride * ride, uint8 direction, uint32 segment, sint32 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); uint32 vehicleIndex = (segment - direction) & 0x3; diff --git a/src/openrct2/ride/gentle/spiral_slide.c b/src/openrct2/ride/gentle/spiral_slide.cpp similarity index 98% rename from src/openrct2/ride/gentle/spiral_slide.c rename to src/openrct2/ride/gentle/spiral_slide.cpp index 43bc103a1c..a3cff3ced7 100644 --- a/src/openrct2/ride/gentle/spiral_slide.c +++ b/src/openrct2/ride/gentle/spiral_slide.cpp @@ -116,10 +116,14 @@ static void spiral_slide_paint_tile_front(paint_session * session, uint8 rideInd sint32 offset = SPIRAL_SLIDE_PEEP + 46 * direction; rct_xyz8 boundingBox = { + .x = 0, + .y = 0, .z = 108 }; rct_xyz16 boundingBoxOffset = { - .z = height + 3 + .x = 0, + .y = 0, + .z = static_cast(height + 3) }; if (direction == 0) { diff --git a/src/openrct2/ride/shops/facility.c b/src/openrct2/ride/shops/facility.cpp similarity index 100% rename from src/openrct2/ride/shops/facility.c rename to src/openrct2/ride/shops/facility.cpp diff --git a/src/openrct2/ride/shops/shop.c b/src/openrct2/ride/shops/shop.cpp similarity index 100% rename from src/openrct2/ride/shops/shop.c rename to src/openrct2/ride/shops/shop.cpp diff --git a/src/openrct2/ride/thrill/3d_cinema.c b/src/openrct2/ride/thrill/3d_cinema.cpp similarity index 97% rename from src/openrct2/ride/thrill/3d_cinema.c rename to src/openrct2/ride/thrill/3d_cinema.cpp index 1c47cfa089..74f6cef1d4 100644 --- a/src/openrct2/ride/thrill/3d_cinema.c +++ b/src/openrct2/ride/thrill/3d_cinema.cpp @@ -25,7 +25,7 @@ */ static void paint_3d_cinema_structure(paint_session * session, uint8 rideIndex, uint8 direction, sint8 xOffset, sint8 yOffset, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); Ride * ride = get_ride(rideIndex); rct_ride_entry * rideEntry = get_ride_entry(ride->subtype); diff --git a/src/openrct2/ride/thrill/enterprise.c b/src/openrct2/ride/thrill/enterprise.cpp similarity index 98% rename from src/openrct2/ride/thrill/enterprise.c rename to src/openrct2/ride/thrill/enterprise.cpp index 8c3db43cc0..939b447278 100644 --- a/src/openrct2/ride/thrill/enterprise.c +++ b/src/openrct2/ride/thrill/enterprise.cpp @@ -26,7 +26,7 @@ static void paint_enterprise_structure(paint_session * session, Ride * ride, sin { height += 7; - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); rct_ride_entry * rideEntry = get_ride_entry(ride->subtype); rct_vehicle * vehicle = NULL; diff --git a/src/openrct2/ride/thrill/go_karts.c b/src/openrct2/ride/thrill/go_karts.cpp similarity index 100% rename from src/openrct2/ride/thrill/go_karts.c rename to src/openrct2/ride/thrill/go_karts.cpp diff --git a/src/openrct2/ride/thrill/launched_freefall.c b/src/openrct2/ride/thrill/launched_freefall.cpp similarity index 100% rename from src/openrct2/ride/thrill/launched_freefall.c rename to src/openrct2/ride/thrill/launched_freefall.cpp diff --git a/src/openrct2/ride/thrill/magic_carpet.c b/src/openrct2/ride/thrill/magic_carpet.cpp similarity index 98% rename from src/openrct2/ride/thrill/magic_carpet.c rename to src/openrct2/ride/thrill/magic_carpet.cpp index bd557bd6bc..ae9ae8bc0c 100644 --- a/src/openrct2/ride/thrill/magic_carpet.c +++ b/src/openrct2/ride/thrill/magic_carpet.cpp @@ -154,7 +154,7 @@ static void paint_magic_carpet_vehicle(paint_session * session, Ride *ride, uint /** rct2: 0x00899104 */ static void paint_magic_carpet_structure(paint_session * session, Ride *ride, uint8 direction, sint8 axisOffset, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); rct_vehicle *vehicle = get_first_vehicle(ride); uint32 swingImageId = 0; diff --git a/src/openrct2/ride/thrill/motion_simulator.c b/src/openrct2/ride/thrill/motion_simulator.cpp similarity index 98% rename from src/openrct2/ride/thrill/motion_simulator.c rename to src/openrct2/ride/thrill/motion_simulator.cpp index 0759456585..7e05eedd20 100644 --- a/src/openrct2/ride/thrill/motion_simulator.c +++ b/src/openrct2/ride/thrill/motion_simulator.cpp @@ -40,7 +40,7 @@ static void paint_motionsimulator_vehicle(paint_session * session, sint8 offsetX Ride *ride = get_ride(mapElement->properties.track.ride_index); rct_ride_entry *rideEntry = get_ride_entry_by_ride(ride); - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); rct_vehicle *vehicle = NULL; if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) { diff --git a/src/openrct2/ride/thrill/pirate_ship.c b/src/openrct2/ride/thrill/pirate_ship.cpp similarity index 99% rename from src/openrct2/ride/thrill/pirate_ship.c rename to src/openrct2/ride/thrill/pirate_ship.cpp index 06989722b0..2bc2f1e3d8 100644 --- a/src/openrct2/ride/thrill/pirate_ship.c +++ b/src/openrct2/ride/thrill/pirate_ship.cpp @@ -70,7 +70,7 @@ static void paint_pirate_ship_structure(paint_session * session, Ride * ride, ui { uint32 imageId, baseImageId; - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); rct_ride_entry * rideType = get_ride_entry(ride->subtype); rct_vehicle * vehicle = NULL; diff --git a/src/openrct2/ride/thrill/roto_drop.c b/src/openrct2/ride/thrill/roto_drop.cpp similarity index 100% rename from src/openrct2/ride/thrill/roto_drop.c rename to src/openrct2/ride/thrill/roto_drop.cpp diff --git a/src/openrct2/ride/thrill/swinging_inverter_ship.c b/src/openrct2/ride/thrill/swinging_inverter_ship.cpp similarity index 98% rename from src/openrct2/ride/thrill/swinging_inverter_ship.c rename to src/openrct2/ride/thrill/swinging_inverter_ship.cpp index d1b9323cfc..091fb5f6e4 100644 --- a/src/openrct2/ride/thrill/swinging_inverter_ship.c +++ b/src/openrct2/ride/thrill/swinging_inverter_ship.cpp @@ -62,7 +62,7 @@ static const uint32 swinging_inverter_ship_frame_sprites[] = { static void paint_swinging_inverter_ship_structure(paint_session * session, Ride * ride, uint8 direction, sint8 axisOffset, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); rct_ride_entry * rideType = get_ride_entry(ride->subtype); rct_vehicle * vehicle = NULL; diff --git a/src/openrct2/ride/thrill/top_spin.c b/src/openrct2/ride/thrill/top_spin.cpp similarity index 98% rename from src/openrct2/ride/thrill/top_spin.c rename to src/openrct2/ride/thrill/top_spin.cpp index d73d77db98..8f8417c89a 100644 --- a/src/openrct2/ride/thrill/top_spin.c +++ b/src/openrct2/ride/thrill/top_spin.cpp @@ -52,7 +52,7 @@ static void top_spin_paint_vehicle(paint_session * session, sint8 al, sint8 cl, uint16 boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ; // As we will be drawing a vehicle we need to backup the mapElement that // is assigned to the drawings. - rct_map_element* curMapElement = session->CurrentlyDrawnItem; + rct_map_element* curMapElement = static_cast(session->CurrentlyDrawnItem); height += 3; @@ -141,12 +141,12 @@ static void top_spin_paint_vehicle(paint_session * session, sint8 al, sint8 cl, rct_xyz16 seatCoords = { .x = al, .y = cl, - .z = height + .z = static_cast(height) }; seatCoords.z += TopSpinSeatHeightOffset[armRotation]; - assert(armRotation < sizeof(TopSpinSeatPositionOffset)); + assert(armRotation < static_cast(sizeof(TopSpinSeatPositionOffset))); switch (direction) { case 0: seatCoords.x -= TopSpinSeatPositionOffset[armRotation]; diff --git a/src/openrct2/ride/thrill/twist.c b/src/openrct2/ride/thrill/twist.cpp similarity index 98% rename from src/openrct2/ride/thrill/twist.c rename to src/openrct2/ride/thrill/twist.cpp index 4c5f16f6a0..a9b513edb7 100644 --- a/src/openrct2/ride/thrill/twist.c +++ b/src/openrct2/ride/thrill/twist.cpp @@ -24,7 +24,7 @@ /** rct2: 0x0076E5C9 */ static void paint_twist_structure(paint_session * session, Ride * ride, uint8 direction, sint8 xOffset, sint8 yOffset, uint16 height) { - rct_map_element * savedMapElement = session->CurrentlyDrawnItem; + rct_map_element * savedMapElement = static_cast(session->CurrentlyDrawnItem); rct_ride_entry * rideEntry = get_ride_entry(ride->subtype); rct_vehicle * vehicle = NULL; diff --git a/src/openrct2/ride/track_paint.h b/src/openrct2/ride/track_paint.h index 8021a1a08a..668e137454 100644 --- a/src/openrct2/ride/track_paint.h +++ b/src/openrct2/ride/track_paint.h @@ -265,6 +265,8 @@ extern const uint8 mapLeftEighthTurnToOrthogonal[5]; extern bool gUseOriginalRidePaint; +extern const uint8 mini_golf_peep_animation_lengths[9]; + bool track_paint_util_has_fence(enum edge_t edge, rct_xy16 position, rct_map_element * mapElement, Ride * ride, uint8 rotation); void track_paint_util_paint_floor(paint_session * session, uint8 edges, uint32 colourFlags, uint16 height, const uint32 floorSprites[4], uint8 rotation); void track_paint_util_paint_fences(paint_session * session, uint8 edges, rct_xy16 position, rct_map_element * mapElement, Ride * ride, uint32 colourFlags, uint16 height, const uint32 fenceSprites[4], uint8 rotation); diff --git a/src/openrct2/ride/transport/chairlift.c b/src/openrct2/ride/transport/chairlift.cpp similarity index 99% rename from src/openrct2/ride/transport/chairlift.c rename to src/openrct2/ride/transport/chairlift.cpp index d1c3858221..0bf67e1a8f 100644 --- a/src/openrct2/ride/transport/chairlift.c +++ b/src/openrct2/ride/transport/chairlift.cpp @@ -73,7 +73,7 @@ enum SPR_CHAIRLIFT_STATION_END_CAP_SE, SPR_CHAIRLIFT_STATION_END_CAP_SW, SPR_CHAIRLIFT_STATION_END_CAP_NW, -} SPR_CHAIRLIFT; +}; const uint32 chairlift_bullwheel_frames[] = { SPR_CHAIRLIFT_BULLWHEEL_FRAME_1, @@ -138,8 +138,8 @@ static bool chairlift_paint_util_is_first_track(uint8 rideIndex, const rct_map_e rct_xy16 delta = TileDirectionDelta[map_element_get_direction(mapElement)]; rct_xy16 newPos = { - .x = pos.x - delta.x, - .y = pos.y - delta.y, + .x = static_cast(pos.x - delta.x), + .y = static_cast(pos.y - delta.y), }; rct_map_element * nextTrack = chairlift_paint_util_map_get_track_element_at_from_ride_fuzzy(newPos.x, newPos.y, mapElement->base_height, rideIndex); @@ -155,8 +155,8 @@ static bool chairlift_paint_util_is_last_track(uint8 rideIndex, const rct_map_el rct_xy16 delta = TileDirectionDelta[map_element_get_direction(mapElement)]; rct_xy16 newPos = { - .x = pos.x + delta.x, - .y = pos.y + delta.y, + .x = static_cast(pos.x + delta.x), + .y = static_cast(pos.y + delta.y), }; rct_map_element * nextTrack = chairlift_paint_util_map_get_track_element_at_from_ride_fuzzy(newPos.x, newPos.y, mapElement->base_height, rideIndex); diff --git a/src/openrct2/ride/transport/lift.c b/src/openrct2/ride/transport/lift.cpp similarity index 100% rename from src/openrct2/ride/transport/lift.c rename to src/openrct2/ride/transport/lift.cpp diff --git a/src/openrct2/ride/transport/miniature_railway.c b/src/openrct2/ride/transport/miniature_railway.cpp similarity index 100% rename from src/openrct2/ride/transport/miniature_railway.c rename to src/openrct2/ride/transport/miniature_railway.cpp diff --git a/src/openrct2/ride/transport/monorail.c b/src/openrct2/ride/transport/monorail.cpp similarity index 100% rename from src/openrct2/ride/transport/monorail.c rename to src/openrct2/ride/transport/monorail.cpp diff --git a/src/openrct2/ride/transport/suspended_monorail.c b/src/openrct2/ride/transport/suspended_monorail.cpp similarity index 100% rename from src/openrct2/ride/transport/suspended_monorail.c rename to src/openrct2/ride/transport/suspended_monorail.cpp diff --git a/src/openrct2/ride/vehicle.c b/src/openrct2/ride/vehicle.c index 634e1104b6..90f4d839dd 100644 --- a/src/openrct2/ride/vehicle.c +++ b/src/openrct2/ride/vehicle.c @@ -8076,8 +8076,6 @@ loc_6DBE7F: return false; } -extern const uint8 mini_golf_peep_animation_lengths[]; - /** * rct2: 0x006DC3A7 * diff --git a/src/openrct2/ride/vehicle_paint.h b/src/openrct2/ride/vehicle_paint.h index 3f206554a7..5bd6f41056 100644 --- a/src/openrct2/ride/vehicle_paint.h +++ b/src/openrct2/ride/vehicle_paint.h @@ -19,6 +19,10 @@ #include "vehicle.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct vehicle_boundbox { sint8 offset_x; sint8 offset_y; @@ -45,4 +49,8 @@ void vehicle_visual_submarine(paint_session * session, sint32 x, sint32 imageDir void vehicle_visual_mini_golf_player(paint_session * session, sint32 x, sint32 imageDirection, sint32 y, sint32 z, rct_vehicle *vehicle); void vehicle_visual_mini_golf_ball(paint_session * session, sint32 x, sint32 imageDirection, sint32 y, sint32 z, rct_vehicle *vehicle); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/openrct2/ride/water/boat_ride.c b/src/openrct2/ride/water/boat_ride.cpp similarity index 100% rename from src/openrct2/ride/water/boat_ride.c rename to src/openrct2/ride/water/boat_ride.cpp diff --git a/src/openrct2/ride/water/dingy_slide.c b/src/openrct2/ride/water/dingy_slide.cpp similarity index 100% rename from src/openrct2/ride/water/dingy_slide.c rename to src/openrct2/ride/water/dingy_slide.cpp diff --git a/src/openrct2/ride/water/log_flume.c b/src/openrct2/ride/water/log_flume.cpp similarity index 100% rename from src/openrct2/ride/water/log_flume.c rename to src/openrct2/ride/water/log_flume.cpp diff --git a/src/openrct2/ride/water/river_rapids.c b/src/openrct2/ride/water/river_rapids.cpp similarity index 100% rename from src/openrct2/ride/water/river_rapids.c rename to src/openrct2/ride/water/river_rapids.cpp diff --git a/src/openrct2/ride/water/splash_boats.c b/src/openrct2/ride/water/splash_boats.cpp similarity index 100% rename from src/openrct2/ride/water/splash_boats.c rename to src/openrct2/ride/water/splash_boats.cpp diff --git a/src/openrct2/ride/water/submarine_ride.c b/src/openrct2/ride/water/submarine_ride.cpp similarity index 100% rename from src/openrct2/ride/water/submarine_ride.c rename to src/openrct2/ride/water/submarine_ride.cpp diff --git a/src/openrct2/ride/water/water_coaster.c b/src/openrct2/ride/water/water_coaster.cpp similarity index 100% rename from src/openrct2/ride/water/water_coaster.c rename to src/openrct2/ride/water/water_coaster.cpp