forked from rosebudai/OpenRCT2-Web
Move Vehicle painting to paint/entity (#26589)
This commit is contained in:
1 parent
2ed2ba3724
commit
ee3d6b163b
7 files changed
+124
-84
No files matched your search
@@ -409,6 +409,7 @@
|
||||
<ClInclude Include="paint\entity\Paint.Peep.h" />
|
||||
<ClInclude Include="paint\entity\Paint.Staff.h" />
|
||||
<ClInclude Include="paint\entity\Paint.SteamParticle.h" />
|
||||
<ClInclude Include="paint\entity\Paint.Vehicle.h" />
|
||||
<ClInclude Include="paint\entity\Paint.VehicleCrashParticle.h" />
|
||||
<ClInclude Include="paint\support\MetalSupports.h" />
|
||||
<ClInclude Include="paint\support\WoodenSupports.h" />
|
||||
@@ -1015,6 +1016,7 @@
|
||||
<ClCompile Include="paint\entity\Paint.Peep.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.Staff.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.SteamParticle.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.Vehicle.cpp" />
|
||||
<ClCompile Include="paint\entity\Paint.VehicleCrashParticle.cpp" />
|
||||
<ClCompile Include="paint\support\MetalSupports.cpp" />
|
||||
<ClCompile Include="paint\support\WoodenSupports.cpp" />
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "entity/Paint.MoneyEffect.h"
|
||||
#include "entity/Paint.Staff.h"
|
||||
#include "entity/Paint.SteamParticle.h"
|
||||
#include "entity/Paint.Vehicle.h"
|
||||
#include "entity/Paint.VehicleCrashParticle.h"
|
||||
#include "vehicle/VehiclePaint.h"
|
||||
|
||||
@@ -139,7 +140,7 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos)
|
||||
switch (entity->type)
|
||||
{
|
||||
case EntityType::vehicle:
|
||||
entity->cast<Vehicle>()->Paint(session, image_direction);
|
||||
PaintVehicle(session, *entity->cast<Vehicle>(), image_direction);
|
||||
if (LightFx::ForVehiclesIsAvailable())
|
||||
{
|
||||
LightFx::AddLightsMagicVehicle(entity->cast<Vehicle>());
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2026 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "Paint.Vehicle.h"
|
||||
|
||||
#include "../../SpriteIds.h"
|
||||
#include "../../paint/vehicle/VehiclePaint.h"
|
||||
#include "../../ride/RideData.h"
|
||||
#include "../Paint.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
void PaintVehicle(PaintSession& session, const Vehicle& vehicle, int32_t imageDirection)
|
||||
{
|
||||
const CarEntry* carEntry;
|
||||
|
||||
if (vehicle.flags.has(VehicleFlag::crashed))
|
||||
{
|
||||
PaintAddImageAsParent(
|
||||
session, ImageId(SPR_WATER_PARTICLES_DENSE_0 + vehicle.animation_frame), { 0, 0, vehicle.z },
|
||||
{ { 0, 0, vehicle.z + 2 }, { 1, 1, 0 } });
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t zOffset = 0;
|
||||
if (vehicle.IsCableLift())
|
||||
{
|
||||
carEntry = &kCableLiftVehicle;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto rideEntry = vehicle.GetRideEntry();
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto carEntryIndex = vehicle.vehicle_type;
|
||||
if (vehicle.flags.has(VehicleFlag::carIsInverted))
|
||||
{
|
||||
carEntryIndex++;
|
||||
zOffset += 16;
|
||||
}
|
||||
|
||||
if (carEntryIndex >= std::size(rideEntry->Cars))
|
||||
{
|
||||
return;
|
||||
}
|
||||
carEntry = &rideEntry->Cars[carEntryIndex];
|
||||
}
|
||||
|
||||
switch (carEntry->PaintStyle)
|
||||
{
|
||||
case VEHICLE_VISUAL_DEFAULT:
|
||||
VehicleVisualDefault(session, imageDirection, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_LAUNCHED_FREEFALL:
|
||||
VehicleVisualLaunchedFreefall(
|
||||
session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_OBSERVATION_TOWER:
|
||||
VehicleVisualObservationTower(
|
||||
session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_RIVER_RAPIDS:
|
||||
VehicleVisualRiverRapids(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_MINI_GOLF_PLAYER:
|
||||
VehicleVisualMiniGolfPlayer(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle);
|
||||
break;
|
||||
case VEHICLE_VISUAL_MINI_GOLF_BALL:
|
||||
VehicleVisualMiniGolfBall(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle);
|
||||
break;
|
||||
case VEHICLE_VISUAL_REVERSER:
|
||||
VehicleVisualReverser(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_SPLASH_BOATS_OR_WATER_COASTER:
|
||||
VehicleVisualSplashBoatsOrWaterCoaster(
|
||||
session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_ROTO_DROP:
|
||||
VehicleVisualRotoDrop(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_VIRGINIA_REEL:
|
||||
VehicleVisualVirginiaReel(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_SUBMARINE:
|
||||
VehicleVisualSubmarine(session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_SPINNING_CARS:
|
||||
VehicleVisualClassicMiniSpinning(
|
||||
session, vehicle.x, imageDirection, vehicle.y, vehicle.z + zOffset, &vehicle, carEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2026 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
struct PaintSession;
|
||||
struct Vehicle;
|
||||
|
||||
void PaintVehicle(PaintSession& session, const Vehicle& vehicle, int32_t imageDirection);
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "../../entity/EntityRegistry.h"
|
||||
#include "../../ride/Ride.h"
|
||||
#include "../Paint.h"
|
||||
#include "../entity/Paint.Vehicle.h"
|
||||
#include "VehiclePaint.h"
|
||||
|
||||
#include <cstdint>
|
||||
@@ -41,6 +42,6 @@ namespace OpenRCT2
|
||||
imageDirection = Entity::Yaw::Add(Entity::Yaw::YawFrom4(session.CurrentRotation), vehicleToPaint->orientation);
|
||||
session.SpritePosition.x = vehicleToPaint->x;
|
||||
session.SpritePosition.y = vehicleToPaint->y;
|
||||
vehicleToPaint->Paint(session, imageDirection);
|
||||
PaintVehicle(session, *vehicleToPaint, imageDirection);
|
||||
}
|
||||
} // namespace OpenRCT2
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "../../Game.h"
|
||||
#include "../../GameState.h"
|
||||
#include "../../SpriteIds.h"
|
||||
#include "../../core/Speed.hpp"
|
||||
#include "../../drawing/Drawing.h"
|
||||
#include "../../drawing/LightFX.h"
|
||||
@@ -19,7 +18,6 @@
|
||||
#include "../../entity/Yaw.hpp"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../ride/CarEntry.h"
|
||||
#include "../../ride/RideData.h"
|
||||
#include "../../ride/Vehicle.h"
|
||||
#include "../Paint.h"
|
||||
|
||||
@@ -4709,82 +4707,3 @@ void VehicleVisualDefault(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Vehicle::Paint(PaintSession& session, int32_t imageDirection) const
|
||||
{
|
||||
const CarEntry* carEntry;
|
||||
|
||||
if (flags.has(VehicleFlag::crashed))
|
||||
{
|
||||
PaintAddImageAsParent(
|
||||
session, ImageId(SPR_WATER_PARTICLES_DENSE_0 + animation_frame), { 0, 0, z }, { { 0, 0, z + 2 }, { 1, 1, 0 } });
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t zOffset = 0;
|
||||
if (IsCableLift())
|
||||
{
|
||||
carEntry = &kCableLiftVehicle;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto rideEntry = GetRideEntry();
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto carEntryIndex = vehicle_type;
|
||||
if (flags.has(VehicleFlag::carIsInverted))
|
||||
{
|
||||
carEntryIndex++;
|
||||
zOffset += 16;
|
||||
}
|
||||
|
||||
if (carEntryIndex >= std::size(rideEntry->Cars))
|
||||
{
|
||||
return;
|
||||
}
|
||||
carEntry = &rideEntry->Cars[carEntryIndex];
|
||||
}
|
||||
|
||||
switch (carEntry->PaintStyle)
|
||||
{
|
||||
case VEHICLE_VISUAL_DEFAULT:
|
||||
VehicleVisualDefault(session, imageDirection, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_LAUNCHED_FREEFALL:
|
||||
VehicleVisualLaunchedFreefall(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_OBSERVATION_TOWER:
|
||||
VehicleVisualObservationTower(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_RIVER_RAPIDS:
|
||||
VehicleVisualRiverRapids(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_MINI_GOLF_PLAYER:
|
||||
VehicleVisualMiniGolfPlayer(session, x, imageDirection, y, z + zOffset, this);
|
||||
break;
|
||||
case VEHICLE_VISUAL_MINI_GOLF_BALL:
|
||||
VehicleVisualMiniGolfBall(session, x, imageDirection, y, z + zOffset, this);
|
||||
break;
|
||||
case VEHICLE_VISUAL_REVERSER:
|
||||
VehicleVisualReverser(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_SPLASH_BOATS_OR_WATER_COASTER:
|
||||
VehicleVisualSplashBoatsOrWaterCoaster(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_ROTO_DROP:
|
||||
VehicleVisualRotoDrop(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_VIRGINIA_REEL:
|
||||
VehicleVisualVirginiaReel(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_SUBMARINE:
|
||||
VehicleVisualSubmarine(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
case VEHICLE_VISUAL_SPINNING_CARS:
|
||||
VehicleVisualClassicMiniSpinning(session, x, imageDirection, y, z + zOffset, this, carEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,6 @@ struct Vehicle : OpenRCT2::EntityBase
|
||||
}
|
||||
void ApplyMass(int16_t appliedMass);
|
||||
void Serialise(OpenRCT2::DataSerialiser& stream);
|
||||
void Paint(PaintSession& session, int32_t imageDirection) const;
|
||||
bool IsCableLift() const;
|
||||
|
||||
friend void UpdateRotatingDefault(Vehicle& vehicle);
|
||||
|
||||
Reference in new issue
Block a user