diff --git a/src/paint/paint.h b/src/paint/paint.h index 1ece628da5..e12b7b0891 100644 --- a/src/paint/paint.h +++ b/src/paint/paint.h @@ -168,4 +168,18 @@ void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sin void viewport_draw_money_effects(); void viewport_paint_setup(); +// TESTING +#ifdef __TESTPAINT__ + void testpaint_clear_ignore(); + void testpaint_ignore(uint8 direction, uint8 trackSequence); + void testpaint_ignore_all(); + bool testpaint_is_ignored(uint8 direction, uint8 trackSequence); + + #define TESTPAINT_IGNORE(direction, trackSequence) testpaint_ignore(direction, trackSequence) + #define TESTPAINT_IGNORE_ALL() testpaint_ignore_all() +#else + #define TESTPAINT_IGNORE(direction, trackSequence) + #define TESTPAINT_IGNORE_ALL() +#endif + #endif diff --git a/test/testpaint/intercept.c b/test/testpaint/intercept.c index 6a44c3423e..82bb8c4076 100644 --- a/test/testpaint/intercept.c +++ b/test/testpaint/intercept.c @@ -576,7 +576,12 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error) callCount = 0; + testpaint_clear_ignore(); newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement); + if (testpaint_is_ignored(direction, trackSequence)) { + sprintf(*error, "[ IGNORED ] [direction:%d trackSequence:%d]\n", direction, trackSequence); + continue; + } uint8 newCallCount = callCount; function_call newCalls[256]; diff --git a/test/testpaint/intercept_2.cpp b/test/testpaint/intercept_2.cpp index ce80ec6ed0..da48fd8ebf 100644 --- a/test/testpaint/intercept_2.cpp +++ b/test/testpaint/intercept_2.cpp @@ -397,8 +397,12 @@ namespace Intercept2 gSupportSegments[s].slope = 0xFF; } + testpaint_clear_ignore(); TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction); newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement); + if (testpaint_is_ignored(direction, trackSequence)) { + continue; + } std::vector newCalls = getSegmentCalls(gSupportSegments, direction); @@ -432,8 +436,12 @@ namespace Intercept2 gSupport.height = 0; gSupport.slope = 0xFF; + testpaint_clear_ignore(); TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction); newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement); + if (testpaint_is_ignored(direction, trackSequence)) { + continue; + } if (referenceGeneralSupportCall.height != -1) { if (gSupport.height != referenceGeneralSupportCall.height) { @@ -583,6 +591,7 @@ namespace Intercept2 gLeftTunnelCount = 0; gRightTunnelCount = 0; + testpaint_clear_ignore(); TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction); for (int offset = -8; offset <= 8; offset += 8) { @@ -757,8 +766,12 @@ namespace Intercept2 for (int direction = 0; direction < 4; direction++) { gVerticalTunnelHeight = 0; + testpaint_clear_ignore(); TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction); newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement); + if (testpaint_is_ignored(direction, trackSequence)) { + continue; + } if (gVerticalTunnelHeight != referenceHeight) { if (referenceHeight == 0) { @@ -795,6 +808,44 @@ namespace Intercept2 return true; } + struct IgnoredEntry + { + uint8 Direction; + uint8 TrackSequence; + }; + + static bool _ignoredAll; + static std::vector _ignoredEntries; + + static void testClearIgnore() + { + _ignoredAll = false; + _ignoredEntries.clear(); + } + + static void testIgnore(uint8 direction, uint8 trackSequence) + { + _ignoredEntries.push_back({ direction, trackSequence }); + } + + static void testIgnoreAll() + { + _ignoredAll = true; + } + + static bool testIsIgnored(uint8 direction, uint8 trackSequence) + { + if (_ignoredAll) return true; + for (const IgnoredEntry &entry : _ignoredEntries) + { + if (entry.Direction == direction && + entry.TrackSequence == trackSequence) + { + return true; + } + } + return false; + } } extern "C" @@ -814,4 +865,23 @@ extern "C" return Intercept2::testVerticalTunnels(rideType, trackType); } + void testpaint_clear_ignore() + { + Intercept2::testClearIgnore(); + } + + void testpaint_ignore(uint8 direction, uint8 trackSequence) + { + Intercept2::testIgnore(direction, trackSequence); + } + + void testpaint_ignore_all() + { + Intercept2::testIgnoreAll(); + } + + bool testpaint_is_ignored(uint8 direction, uint8 trackSequence) + { + return Intercept2::testIsIgnored(direction, trackSequence); + } } diff --git a/test/testpaint/testpaint.vcxproj b/test/testpaint/testpaint.vcxproj index 5cbf078e8b..aa2e3b925c 100644 --- a/test/testpaint/testpaint.vcxproj +++ b/test/testpaint/testpaint.vcxproj @@ -60,7 +60,7 @@ Level3 Disabled true - DEBUG;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + __TESTPAINT__;DEBUG;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true 4200 @@ -72,7 +72,7 @@ true true true - NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + __TESTPAINT__;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true 4200 diff --git a/test/testpaint/testpaint.vcxproj.user b/test/testpaint/testpaint.vcxproj.user index 1bb4d146b6..33d0913624 100644 --- a/test/testpaint/testpaint.vcxproj.user +++ b/test/testpaint/testpaint.vcxproj.user @@ -4,13 +4,13 @@ $(TargetDir)\openrct2.exe $(TargetDir) WindowsLocalDebugger - --ride-type 4 + --ride-type 42 false - --ride-type 4 + --ride-type 42 WindowsLocalDebugger \ No newline at end of file