mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 08:12:53 +01:00
testpaint: Test chain lift and improve general support height assertion
This commit is contained in:
@@ -545,6 +545,13 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error)
|
||||
|
||||
TRACK_PAINT_FUNCTION_GETTER newPaintGetter = RideTypeTrackPaintFunctions[rideType];
|
||||
int sequenceCount = getTrackSequenceCount(rideType, trackType);
|
||||
|
||||
for (int chainLift = 0; chainLift < 2; chainLift++) {
|
||||
if (chainLift == 0) {
|
||||
mapElement.type &= ~0x80;
|
||||
} else {
|
||||
mapElement.type |= 0x80;
|
||||
}
|
||||
for (int currentRotation = 0; currentRotation < 4; currentRotation++) {
|
||||
gCurrentRotation = currentRotation;
|
||||
for (int direction = 0; direction < 4; direction++) {
|
||||
@@ -584,7 +591,7 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error)
|
||||
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);
|
||||
sprintf(*error, "[ IGNORED ] [direction:%d trackSequence:%d chainLift:%d]\n", direction, trackSequence, chainLift);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -602,9 +609,9 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error)
|
||||
sprintf(diff + strlen(diff), ">>> ACTUAL\n");
|
||||
|
||||
if (oldCallCount != newCallCount) {
|
||||
sprintf(*error + strlen(*error), "Call counts don't match (was %d, expected %d) [direction:%d trackSequence:%d]", newCallCount, oldCallCount, direction, trackSequence);
|
||||
sprintf(*error + strlen(*error), "Call counts don't match (was %d, expected %d) [direction:%d trackSequence:%d chainLift:%d]", newCallCount, oldCallCount, direction, trackSequence, chainLift);
|
||||
} else {
|
||||
sprintf(*error + strlen(*error), "Calls don't match [direction:%d trackSequence:%d]", direction, trackSequence);
|
||||
sprintf(*error + strlen(*error), "Calls don't match [direction:%d trackSequence:%d chainLift:%d]", direction, trackSequence, chainLift);
|
||||
}
|
||||
|
||||
sprintf(*error + strlen(*error), "\n%s", diff);
|
||||
@@ -617,6 +624,7 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(*error + strlen(*error), "");
|
||||
|
||||
|
||||
@@ -344,6 +344,12 @@ namespace Intercept2
|
||||
TRACK_PAINT_FUNCTION_GETTER newPaintGetter = RideTypeTrackPaintFunctions[rideType];
|
||||
int sequenceCount = getTrackSequenceCount(rideType, trackType);
|
||||
|
||||
for (int chainLift = 0; chainLift < 2; chainLift++) {
|
||||
if (chainLift == 0) {
|
||||
mapElement.type &= ~0x80;
|
||||
} else {
|
||||
mapElement.type |= 0x80;
|
||||
}
|
||||
|
||||
for (int trackSequence = 0; trackSequence < sequenceCount; trackSequence++) {
|
||||
std::vector<SegmentSupportCall> tileSegmentSupportCalls[4];
|
||||
@@ -387,7 +393,7 @@ namespace Intercept2
|
||||
|
||||
if (!segmentCallsMatch(tileSegmentSupportCalls)) {
|
||||
// TODO: if 3 directions do share the same mask, use that call list as a reference.
|
||||
printf("Original segment calls didn't match. [trackSequence:%d]\n", trackSequence);
|
||||
printf("Original segment calls didn't match. [trackSequence:%d chainLift:%d]\n", trackSequence, chainLift);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -415,8 +421,8 @@ namespace Intercept2
|
||||
printSegmentSupports(&diff, newCalls);
|
||||
sprintf(diff + strlen(diff), ">>> ACTUAL\n");
|
||||
|
||||
printf("Segment support heights didn't match. [direction:%d trackSequence:%d]\n", direction,
|
||||
trackSequence);
|
||||
printf("Segment support heights didn't match. [direction:%d trackSequence:%d chainLift:%d]\n", direction,
|
||||
trackSequence, chainLift);
|
||||
printf("%s", diff);
|
||||
delete[] diff;
|
||||
return false;
|
||||
@@ -425,7 +431,7 @@ namespace Intercept2
|
||||
|
||||
if (!supportCallsMatch(tileGeneralSupportCalls)) {
|
||||
// TODO: if 3 directions do share the output, use that.
|
||||
printf("Original support calls didn't match. [trackSequence:%d]\n", trackSequence);
|
||||
printf("Original support calls didn't match. [trackSequence:%d chainLift:%d]\n", trackSequence, chainLift);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -445,22 +451,26 @@ namespace Intercept2
|
||||
|
||||
if (referenceGeneralSupportCall.height != -1) {
|
||||
if (gSupport.height != referenceGeneralSupportCall.height) {
|
||||
printf("General support heights didn't match. (expected %d, actual: %d) [direction:%d trackSequence:%d]\n", referenceGeneralSupportCall.height,gSupport.height, direction,
|
||||
trackSequence);
|
||||
printf("General support heights didn't match. (expected height + %d, actual: height + %d) [direction:%d trackSequence:%d chainLift:%d]\n",
|
||||
referenceGeneralSupportCall.height - height,
|
||||
gSupport.height - height,
|
||||
direction,
|
||||
trackSequence,
|
||||
chainLift);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (referenceGeneralSupportCall.slope != -1) {
|
||||
if (gSupport.slope != referenceGeneralSupportCall.slope) {
|
||||
printf("General support slopes didn't match. [direction:%d trackSequence:%d]\n", direction,
|
||||
trackSequence);
|
||||
printf("General support slopes didn't match. [direction:%d trackSequence:%d chainLift:%d]\n", direction,
|
||||
trackSequence, chainLift);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user