| 1345 | } |
| 1346 | |
| 1347 | VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlags) |
| 1348 | { |
| 1349 | // the cut-away view is active and see-through is activated |
| 1350 | auto cutAwayViewWithTransparency = (viewFlags & VIEWPORT_FLAG_CLIP_VIEW) |
| 1351 | && (viewFlags & VIEWPORT_FLAG_CLIP_VIEW_SEE_THROUGH); |
| 1352 | |
| 1353 | // the element is above the cut-off height |
| 1354 | auto clipped = cutAwayViewWithTransparency && ps->Element == nullptr && ps->Entity != nullptr |
| 1355 | && ps->Entity->getLocation().z > (gClipHeight * kCoordsZStep); |
| 1356 | |
| 1357 | // the entity is above the cut-off height |
| 1358 | clipped |= cutAwayViewWithTransparency && ps->Element != nullptr |
| 1359 | && (ps->Element->getBaseZ() > gClipHeight * kCoordsZStep); |
| 1360 | |
| 1361 | switch (ps->InteractionItem) |
| 1362 | { |
| 1363 | case ViewportInteractionItem::entity: |
| 1364 | if (ps->Entity != nullptr) |
| 1365 | { |
| 1366 | switch (ps->Entity->type) |
| 1367 | { |
| 1368 | case EntityType::vehicle: |
| 1369 | { |
| 1370 | if (viewFlags & VIEWPORT_FLAG_HIDE_VEHICLES || clipped) |
| 1371 | { |
| 1372 | return (viewFlags & VIEWPORT_FLAG_INVISIBLE_VEHICLES) ? VisibilityKind::hidden |
| 1373 | : VisibilityKind::partial; |
| 1374 | } |
| 1375 | // Rides without track can technically have a 'vehicle': |
| 1376 | // these should be hidden if 'hide rides' is enabled |
| 1377 | if (viewFlags & VIEWPORT_FLAG_HIDE_RIDES || clipped) |
| 1378 | { |
| 1379 | auto vehicle = ps->Entity->as<Vehicle>(); |
| 1380 | if (vehicle == nullptr) |
| 1381 | break; |
| 1382 | |
| 1383 | auto ride = vehicle->GetRide(); |
| 1384 | if (ride != nullptr && !ride->getRideTypeDescriptor().flags.has(RtdFlag::hasTrack)) |
| 1385 | { |
| 1386 | return (viewFlags & VIEWPORT_FLAG_INVISIBLE_RIDES) ? VisibilityKind::hidden |
| 1387 | : VisibilityKind::partial; |
| 1388 | } |
| 1389 | } |
| 1390 | break; |
| 1391 | } |
| 1392 | case EntityType::guest: |
| 1393 | if (viewFlags & VIEWPORT_FLAG_HIDE_GUESTS) |
| 1394 | { |
| 1395 | return VisibilityKind::hidden; |
| 1396 | } |
| 1397 | else if (clipped) |
| 1398 | { |
| 1399 | return VisibilityKind::partial; |
| 1400 | } |
| 1401 | break; |
| 1402 | case EntityType::staff: |
| 1403 | if (viewFlags & VIEWPORT_FLAG_HIDE_STAFF) |
| 1404 | { |
no test coverage detected