mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #14780 from duncanspumpkin/sprite2
Sprite Refactor 2: Moving around EntityTweener and misc
This commit is contained in:
commit
b7e7915efa
|
@ -764,6 +764,8 @@
|
|||
F7D774AC1EC6741D00BE6EBC /* language in CopyFiles */ = {isa = PBXBuildFile; fileRef = D4EC48E41C2637710024B507 /* language */; };
|
||||
F7D774AD1EC6741D00BE6EBC /* shaders in CopyFiles */ = {isa = PBXBuildFile; fileRef = D43407E11D0E14CE00C2B3D4 /* shaders */; };
|
||||
F7D774AE1EC6741D00BE6EBC /* sequence in CopyFiles */ = {isa = PBXBuildFile; fileRef = D4EC48E51C2637710024B507 /* sequence */; };
|
||||
E73A781EBC3C440A99D59821 /* EntityTweener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EB0D1DF6CC74E4190301D84 /* EntityTweener.cpp */; };
|
||||
F42186C5840D4196981ADD16 /* EntityTweener.h in Headers */ = {isa = PBXBuildFile; fileRef = 091352A950004312BAB18717 /* EntityTweener.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -1830,6 +1832,8 @@
|
|||
F7CB864C1EEDA1A80030C877 /* WindowManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowManager.h; sourceTree = "<group>"; };
|
||||
F7D7747E1EC61E5100BE6EBC /* UiContext.macOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UiContext.macOS.mm; sourceTree = "<group>"; usesTabs = 0; };
|
||||
F7D774841EC66CD700BE6EBC /* OpenRCT2-cli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "OpenRCT2-cli"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0EB0D1DF6CC74E4190301D84 /* EntityTweener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EntityTweener.cpp; path = src/openrct2/world/EntityTweener.cpp; sourceTree = SOURCE_ROOT; };
|
||||
091352A950004312BAB18717 /* EntityTweener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EntityTweener.h; path = src/openrct2/world/EntityTweener.h; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -3116,6 +3120,8 @@
|
|||
4C7B54402007646A00A52E21 /* Wall.cpp */,
|
||||
4C7B54412007646A00A52E21 /* Wall.h */,
|
||||
4C7B54422007646A00A52E21 /* Water.h */,
|
||||
0EB0D1DF6CC74E4190301D84 /* EntityTweener.cpp */,
|
||||
091352A950004312BAB18717 /* EntityTweener.h */,
|
||||
);
|
||||
path = world;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3458,6 +3464,7 @@
|
|||
66A10ECE257F1DF800DD651A /* BannerSetNameAction.h in Headers */,
|
||||
2ADE2F342244191E002598AF /* VirtualFloor.h in Headers */,
|
||||
66A10F8B257F1E1800DD651A /* LandSmoothAction.h in Headers */,
|
||||
F42186C5840D4196981ADD16 /* EntityTweener.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4261,6 +4268,7 @@
|
|||
C68878F020289B9B0084B384 /* CorkscrewRollerCoaster.cpp in Sources */,
|
||||
66A10FD1257F1E3000DD651A /* WaterRaiseAction.cpp in Sources */,
|
||||
C688791820289B9B0084B384 /* MonorailCycles.cpp in Sources */,
|
||||
E73A781EBC3C440A99D59821 /* EntityTweener.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <openrct2/world/Banner.h>
|
||||
#include <openrct2/world/Map.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
|
||||
struct RCTMouseData
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# include <openrct2-ui/input/ShortcutManager.h>
|
||||
# include <openrct2/Input.h>
|
||||
# include <openrct2/world/Map.h>
|
||||
# include <openrct2/world/Sprite.h>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Ui;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
# include <openrct2/localisation/StringIds.h>
|
||||
# include <openrct2/scripting/Plugin.h>
|
||||
# include <openrct2/sprites.h>
|
||||
# include <openrct2/world/Sprite.h>
|
||||
# include <optional>
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <openrct2/Context.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
|
||||
static void window_editor_main_paint(rct_window* w, rct_drawpixelinfo* dpi);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <openrct2/Context.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
|
||||
// clang-format off
|
||||
static rct_widget window_main_widgets[] = {
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/EntityList.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "world/Map.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Scenery.h"
|
||||
#include "world/Sprite.h"
|
||||
#include "world/Surface.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "ui/UiContext.h"
|
||||
#include "ui/WindowManager.h"
|
||||
#include "util/Util.h"
|
||||
#include "world/EntityTweener.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Sprite.h"
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "object/ObjectManager.h"
|
||||
#include "object/ObjectRepository.h"
|
||||
#include "rct2/S6Exporter.h"
|
||||
#include "world/EntityTweener.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Sprite.h"
|
||||
#include "zlib.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
BannerSetNameAction::BannerSetNameAction(BannerIndex bannerIndex, const std::string& name)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
|
||||
LandBuyRightsAction::LandBuyRightsAction(const MapRange& range, LandBuyRightSetting setting)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
|
||||
LandLowerAction::LandLowerAction(const CoordsXY& coords, MapRange range, uint8_t selectionType)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
|
||||
LandRaiseAction::LandRaiseAction(const CoordsXY& coords, MapRange range, uint8_t selectionType)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/SmallScenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElementsView.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElementsView.h"
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
|
||||
LandSmoothAction::LandSmoothAction(const CoordsXY& coords, MapRange range, uint8_t selectionType, bool isLowering)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../ride/Ride.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/SmallScenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/TileElementsView.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "../world/Footpath.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
|
||||
PlaceParkEntranceAction::PlaceParkEntranceAction(const CoordsXYZD& location, ObjectEntryIndex pathType)
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "../world/Banner.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "MazeSetTrackAction.h"
|
||||
#include "TrackRemoveAction.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../ride/Ride.h"
|
||||
#include "../ride/Station.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
RideEntranceExitPlaceAction::RideEntranceExitPlaceAction(
|
||||
const CoordsXY& loc, Direction direction, ride_id_t rideIndex, StationIndex stationNum, bool isExit)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "../management/Finance.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
RideSetColourSchemeAction::RideSetColourSchemeAction(
|
||||
const CoordsXYZD& location, track_type_t trackType, uint16_t newColourScheme)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../ride/RideData.h"
|
||||
#include "../ride/ShopItem.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
RideSetPriceAction::RideSetPriceAction(ride_id_t rideIndex, money16 price, bool primaryPrice)
|
||||
: _rideIndex(rideIndex)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
static rct_string_id _StatusErrorTitles[] = {
|
||||
STR_CANT_CLOSE,
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
SignSetStyleAction::SignSetStyleAction(BannerIndex bannerIndex, uint8_t mainColour, uint8_t textColour, bool isLarge)
|
||||
: _bannerIndex(bannerIndex)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/SmallScenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElement.h"
|
||||
#include "GameAction.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../ride/Ride.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/SmallScenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/TileElementsView.h"
|
||||
#include "GameAction.h"
|
||||
#include "SmallSceneryPlaceAction.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/SmallScenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElement.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "../ui/WindowManager.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
StaffSetColourAction::StaffSetColourAction(StaffType staffType, uint8_t colour)
|
||||
: _staffType(static_cast<uint8_t>(staffType))
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "../world/Climate.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Colour.h"
|
||||
#include "Window.h"
|
||||
#include "Window_internal.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Viewport.h"
|
||||
#include "Widget.h"
|
||||
#include "Window_internal.h"
|
||||
|
|
|
@ -443,6 +443,7 @@
|
|||
<ClInclude Include="world\Duck.h" />
|
||||
<ClInclude Include="world\Entity.h" />
|
||||
<ClInclude Include="world\EntityList.h" />
|
||||
<ClInclude Include="world\EntityTweener.h" />
|
||||
<ClInclude Include="world\Entrance.h" />
|
||||
<ClInclude Include="world\Footpath.h" />
|
||||
<ClInclude Include="world\Fountain.h" />
|
||||
|
@ -865,6 +866,7 @@
|
|||
<ClCompile Include="world\Climate.cpp" />
|
||||
<ClCompile Include="world\Duck.cpp" />
|
||||
<ClCompile Include="world\Entity.cpp" />
|
||||
<ClCompile Include="world\EntityTweener.cpp" />
|
||||
<ClCompile Include="world\Entrance.cpp" />
|
||||
<ClCompile Include="world\Footpath.cpp" />
|
||||
<ClCompile Include="world\Fountain.cpp" />
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../util/Util.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
// Monthly research funding costs
|
||||
const money32 research_cost_table[RESEARCH_FUNDING_COUNT] = {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../ui/WindowManager.h"
|
||||
#include "../util/SawyerCoding.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/EntityTweener.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/Sprite.h"
|
||||
#include "network.h"
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "../../world/Fountain.h"
|
||||
#include "../../world/MoneyEffect.h"
|
||||
#include "../../world/Particle.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Paint.h"
|
||||
#include "Paint.Sprite.h"
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "../../drawing/LightFX.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../peep/Peep.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Paint.h"
|
||||
#include "Paint.Sprite.h"
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "../../world/MoneyEffect.h"
|
||||
#include "../../world/Park.h"
|
||||
#include "../../world/Particle.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Paint.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "../../world/Entrance.h"
|
||||
#include "../../world/Footpath.h"
|
||||
#include "../../world/Scenery.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../Paint.h"
|
||||
#include "../Supports.h"
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "../world/Map.h"
|
||||
#include "../world/MoneyEffect.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Particle.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
|
@ -897,8 +898,8 @@ void Guest::Tick128UpdateGuest(int32_t index)
|
|||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Crash, { x, y, z });
|
||||
|
||||
sprite_misc_explosion_cloud_create({ x, y, z + 16 });
|
||||
sprite_misc_explosion_flare_create({ x, y, z + 16 });
|
||||
ExplosionCloud::Create({ x, y, z + 16 });
|
||||
ExplosionFlare::Create({ x, y, z + 16 });
|
||||
|
||||
Remove();
|
||||
return;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "../windows/Intent.h"
|
||||
#include "../world/Balloon.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/EntityTweener.h"
|
||||
#include "../world/Entrance.h"
|
||||
#include "../world/Footpath.h"
|
||||
#include "../world/LargeScenery.h"
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "../world/Climate.h"
|
||||
#include "../world/Duck.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/EntityTweener.h"
|
||||
#include "../world/Entrance.h"
|
||||
#include "../world/Fountain.h"
|
||||
#include "../world/Litter.h"
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "../rct12/RCT12.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Ride.h"
|
||||
#include "RideData.h"
|
||||
#include "Track.h"
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "../localisation/StringIds.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
ShopItem& operator++(ShopItem& d, int)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "../peep/Peep.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Track.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "../scenario/Scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "RideData.h"
|
||||
#include "Station.h"
|
||||
#include "TrackData.h"
|
||||
|
|
|
@ -3600,7 +3600,7 @@ void Vehicle::UpdateCollisionSetup()
|
|||
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Crash, { train->x, train->y, train->z });
|
||||
|
||||
sprite_misc_explosion_cloud_create({ train->x, train->y, train->z });
|
||||
ExplosionCloud::Create({ train->x, train->y, train->z });
|
||||
|
||||
for (int32_t i = 0; i < 10; i++)
|
||||
{
|
||||
|
@ -5358,8 +5358,8 @@ void Vehicle::CrashOnLand()
|
|||
sub_state = 2;
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Crash, { x, y, z });
|
||||
|
||||
sprite_misc_explosion_cloud_create({ x, y, z });
|
||||
sprite_misc_explosion_flare_create({ x, y, z });
|
||||
ExplosionCloud::Create({ x, y, z });
|
||||
ExplosionFlare::Create({ x, y, z });
|
||||
|
||||
uint8_t numParticles = std::min(sprite_width, static_cast<uint8_t>(7));
|
||||
|
||||
|
@ -5459,7 +5459,7 @@ void Vehicle::UpdateCrash()
|
|||
{
|
||||
int32_t xOffset = (scenario_rand() & 2) - 1;
|
||||
int32_t yOffset = (scenario_rand() & 2) - 1;
|
||||
sprite_misc_explosion_cloud_create({ curVehicle->x + xOffset, curVehicle->y + yOffset, curVehicle->z });
|
||||
ExplosionCloud::Create({ curVehicle->x + xOffset, curVehicle->y + yOffset, curVehicle->z });
|
||||
}
|
||||
}
|
||||
if (curVehicle->var_C8 + 7281 > 0xFFFF)
|
||||
|
@ -7225,28 +7225,6 @@ void Vehicle::UpdateSpinningCar()
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006734B2
|
||||
*/
|
||||
static void steam_particle_create(const CoordsXYZ& coords)
|
||||
{
|
||||
auto surfaceElement = map_get_surface_element_at(coords);
|
||||
if (surfaceElement != nullptr && coords.z > surfaceElement->GetBaseZ())
|
||||
{
|
||||
SteamParticle* steam = CreateEntity<SteamParticle>();
|
||||
if (steam == nullptr)
|
||||
return;
|
||||
|
||||
steam->sprite_width = 20;
|
||||
steam->sprite_height_negative = 18;
|
||||
steam->sprite_height_positive = 16;
|
||||
steam->frame = 256;
|
||||
steam->time_to_move = 0;
|
||||
steam->MoveTo(coords);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006D63D4
|
||||
|
@ -7298,7 +7276,7 @@ void Vehicle::UpdateAdditionalAnimation()
|
|||
}();
|
||||
int32_t directionIndex = sprite_direction >> 1;
|
||||
auto offset = SteamParticleOffsets[typeIndex][directionIndex];
|
||||
steam_particle_create({ x + offset.x, y + offset.y, z + offset.z });
|
||||
SteamParticle::Create({ x + offset.x, y + offset.y, z + offset.z });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../../paint/Supports.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "../../paint/Supports.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../../paint/Supports.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/tile_element/Paint.TileElement.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "../../interface/Viewport.h"
|
||||
#include "../../paint/Paint.h"
|
||||
#include "../../paint/Supports.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
#include "../Vehicle.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "../../interface/Viewport.h"
|
||||
#include "../../paint/Paint.h"
|
||||
#include "../../paint/Supports.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "../../interface/Viewport.h"
|
||||
#include "../../paint/Paint.h"
|
||||
#include "../../paint/Supports.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../../paint/Supports.h"
|
||||
#include "../../scenario/Scenario.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
#include "../Vehicle.h"
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "../world/Map.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Water.h"
|
||||
#include "ScenarioRepository.h"
|
||||
#include "ScenarioSources.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "../ride/TrackData.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Intent.h"
|
||||
|
||||
#include <iterator>
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "Fountain.h"
|
||||
#include "MoneyEffect.h"
|
||||
#include "Particle.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
static void EntityBaseSerialise(SpriteBase& base, DataSerialiser& stream)
|
||||
{
|
||||
|
|
|
@ -27,3 +27,17 @@ template<typename T = SpriteBase> T* TryGetEntity(size_t sprite_idx)
|
|||
auto spr = try_get_sprite(sprite_idx);
|
||||
return spr != nullptr ? spr->As<T>() : nullptr;
|
||||
}
|
||||
|
||||
SpriteBase* CreateEntity(EntityType type);
|
||||
template<typename T> T* CreateEntity()
|
||||
{
|
||||
return static_cast<T*>(CreateEntity(T::cEntityType));
|
||||
}
|
||||
|
||||
// Use only with imports that must happen at a specified index
|
||||
SpriteBase* CreateEntityAt(const uint16_t index, const EntityType type);
|
||||
// Use only with imports that must happen at a specified index
|
||||
template<typename T> T* CreateEntityAt(const uint16_t index)
|
||||
{
|
||||
return static_cast<T*>(CreateEntityAt(index, T::cEntityType));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2021 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 "EntityTweener.h"
|
||||
|
||||
#include "../peep/Peep.h"
|
||||
#include "../ride/Vehicle.h"
|
||||
#include "EntityList.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
void EntityTweener::PopulateEntities()
|
||||
{
|
||||
for (auto ent : EntityList<Guest>())
|
||||
{
|
||||
Entities.push_back(ent);
|
||||
PrePos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
for (auto ent : EntityList<Staff>())
|
||||
{
|
||||
Entities.push_back(ent);
|
||||
PrePos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
for (auto ent : EntityList<Vehicle>())
|
||||
{
|
||||
Entities.push_back(ent);
|
||||
PrePos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::PreTick()
|
||||
{
|
||||
Restore();
|
||||
Reset();
|
||||
PopulateEntities();
|
||||
}
|
||||
|
||||
void EntityTweener::PostTick()
|
||||
{
|
||||
for (auto* ent : Entities)
|
||||
{
|
||||
if (ent == nullptr)
|
||||
{
|
||||
// Sprite was removed, add a dummy position to keep the index aligned.
|
||||
PostPos.emplace_back(0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
PostPos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::RemoveEntity(SpriteBase* entity)
|
||||
{
|
||||
if (!entity->Is<Peep>() && !entity->Is<Vehicle>())
|
||||
{
|
||||
// Only peeps and vehicles are tweened, bail if type is incorrect.
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = std::find(Entities.begin(), Entities.end(), entity);
|
||||
if (it != Entities.end())
|
||||
*it = nullptr;
|
||||
}
|
||||
|
||||
void EntityTweener::Tween(float alpha)
|
||||
{
|
||||
const float inv = (1.0f - alpha);
|
||||
for (size_t i = 0; i < Entities.size(); ++i)
|
||||
{
|
||||
auto* ent = Entities[i];
|
||||
if (ent == nullptr)
|
||||
continue;
|
||||
|
||||
auto& posA = PrePos[i];
|
||||
auto& posB = PostPos[i];
|
||||
|
||||
if (posA == posB)
|
||||
continue;
|
||||
|
||||
sprite_set_coordinates(
|
||||
{ static_cast<int32_t>(std::round(posB.x * alpha + posA.x * inv)),
|
||||
static_cast<int32_t>(std::round(posB.y * alpha + posA.y * inv)),
|
||||
static_cast<int32_t>(std::round(posB.z * alpha + posA.z * inv)) },
|
||||
ent);
|
||||
ent->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::Restore()
|
||||
{
|
||||
for (size_t i = 0; i < Entities.size(); ++i)
|
||||
{
|
||||
auto* ent = Entities[i];
|
||||
if (ent == nullptr)
|
||||
continue;
|
||||
|
||||
sprite_set_coordinates(PostPos[i], ent);
|
||||
ent->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::Reset()
|
||||
{
|
||||
Entities.clear();
|
||||
PrePos.clear();
|
||||
PostPos.clear();
|
||||
}
|
||||
|
||||
static EntityTweener tweener;
|
||||
|
||||
EntityTweener& EntityTweener::Get()
|
||||
{
|
||||
return tweener;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2021 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 "SpriteBase.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class EntityTweener
|
||||
{
|
||||
std::vector<SpriteBase*> Entities;
|
||||
std::vector<CoordsXYZ> PrePos;
|
||||
std::vector<CoordsXYZ> PostPos;
|
||||
|
||||
private:
|
||||
void PopulateEntities();
|
||||
|
||||
public:
|
||||
static EntityTweener& Get();
|
||||
|
||||
void PreTick();
|
||||
void PostTick();
|
||||
void RemoveEntity(SpriteBase* entity);
|
||||
void Tween(float alpha);
|
||||
void Restore();
|
||||
void Reset();
|
||||
};
|
|
@ -24,7 +24,6 @@
|
|||
#include "Map.h"
|
||||
#include "MapAnimation.h"
|
||||
#include "Park.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "Map.h"
|
||||
#include "Scenery.h"
|
||||
#include "SmallScenery.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
using map_animation_invalidate_event_handler = bool (*)(const CoordsXYZ& loc);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../interface/Window.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../network/network.h"
|
||||
#include "Entity.h"
|
||||
#include "Map.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
|
|
|
@ -143,3 +143,108 @@ void CrashSplashParticle::Update()
|
|||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006734B2
|
||||
*/
|
||||
void SteamParticle::Create(const CoordsXYZ& coords)
|
||||
{
|
||||
auto surfaceElement = map_get_surface_element_at(coords);
|
||||
if (surfaceElement != nullptr && coords.z > surfaceElement->GetBaseZ())
|
||||
{
|
||||
SteamParticle* steam = CreateEntity<SteamParticle>();
|
||||
if (steam == nullptr)
|
||||
return;
|
||||
|
||||
steam->sprite_width = 20;
|
||||
steam->sprite_height_negative = 18;
|
||||
steam->sprite_height_positive = 16;
|
||||
steam->frame = 256;
|
||||
steam->time_to_move = 0;
|
||||
steam->MoveTo(coords);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00673200
|
||||
*/
|
||||
void SteamParticle::Update()
|
||||
{
|
||||
// Move up 1 z every 3 ticks (Starts after 4 ticks)
|
||||
Invalidate();
|
||||
time_to_move++;
|
||||
if (time_to_move >= 4)
|
||||
{
|
||||
time_to_move = 1;
|
||||
MoveTo({ x, y, z + 1 });
|
||||
}
|
||||
frame += 64;
|
||||
if (frame >= (56 * 64))
|
||||
{
|
||||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0067363D
|
||||
*/
|
||||
void ExplosionCloud::Create(const CoordsXYZ& cloudPos)
|
||||
{
|
||||
auto* entity = CreateEntity<ExplosionCloud>();
|
||||
if (entity != nullptr)
|
||||
{
|
||||
entity->sprite_width = 44;
|
||||
entity->sprite_height_negative = 32;
|
||||
entity->sprite_height_positive = 34;
|
||||
entity->MoveTo(cloudPos + CoordsXYZ{ 0, 0, 4 });
|
||||
entity->frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00673385
|
||||
*/
|
||||
void ExplosionCloud::Update()
|
||||
{
|
||||
Invalidate();
|
||||
frame += 128;
|
||||
if (frame >= (36 * 128))
|
||||
{
|
||||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0067366B
|
||||
*/
|
||||
void ExplosionFlare::Create(const CoordsXYZ& flarePos)
|
||||
{
|
||||
auto* entity = CreateEntity<ExplosionFlare>();
|
||||
if (entity != nullptr)
|
||||
{
|
||||
entity->sprite_width = 25;
|
||||
entity->sprite_height_negative = 85;
|
||||
entity->sprite_height_positive = 8;
|
||||
entity->MoveTo(flarePos + CoordsXYZ{ 0, 0, 4 });
|
||||
entity->frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006733B4
|
||||
*/
|
||||
void ExplosionFlare::Update()
|
||||
{
|
||||
Invalidate();
|
||||
frame += 64;
|
||||
if (frame >= (124 * 64))
|
||||
{
|
||||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,3 +39,29 @@ struct CrashSplashParticle : MiscEntity
|
|||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
struct ExplosionFlare : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::ExplosionFlare;
|
||||
static void Create(const CoordsXYZ& flarePos);
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
struct ExplosionCloud : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::ExplosionCloud;
|
||||
static void Create(const CoordsXYZ& cloudPos);
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
struct SteamParticle : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::SteamParticle;
|
||||
uint16_t time_to_move;
|
||||
|
||||
static void Create(const CoordsXYZ& coords);
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../scenario/Scenario.h"
|
||||
#include "Balloon.h"
|
||||
#include "Duck.h"
|
||||
#include "EntityTweener.h"
|
||||
#include "Fountain.h"
|
||||
#include "MoneyEffect.h"
|
||||
#include "Particle.h"
|
||||
|
@ -318,25 +319,6 @@ static void sprite_reset(SpriteBase* sprite)
|
|||
sprite->Type = EntityType::Null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all the unused sprite memory to zero. Probably so that it can be compressed better when saving.
|
||||
* rct2: 0x0069EBA4
|
||||
*/
|
||||
void sprite_clear_all_unused()
|
||||
{
|
||||
for (auto index : _freeIdList)
|
||||
{
|
||||
auto* entity = GetEntity(index);
|
||||
if (entity == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sprite_reset(entity);
|
||||
|
||||
_spriteFlashingList[entity->sprite_index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr uint16_t MAX_MISC_SPRITES = 300;
|
||||
static void AddToEntityList(SpriteBase* entity)
|
||||
{
|
||||
|
@ -393,7 +375,7 @@ static void PrepareNewEntity(SpriteBase* base, const EntityType type)
|
|||
SpriteSpatialInsert(base, { LOCATION_NULL, 0 });
|
||||
}
|
||||
|
||||
rct_sprite* create_sprite(EntityType type)
|
||||
SpriteBase* CreateEntity(EntityType type)
|
||||
{
|
||||
if (_freeIdList.size() == 0)
|
||||
{
|
||||
|
@ -413,16 +395,16 @@ rct_sprite* create_sprite(EntityType type)
|
|||
}
|
||||
}
|
||||
|
||||
auto* sprite = GetEntity(_freeIdList.back());
|
||||
if (sprite == nullptr)
|
||||
auto* entity = GetEntity(_freeIdList.back());
|
||||
if (entity == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
_freeIdList.pop_back();
|
||||
|
||||
PrepareNewEntity(sprite, type);
|
||||
PrepareNewEntity(entity, type);
|
||||
|
||||
return reinterpret_cast<rct_sprite*>(sprite);
|
||||
return entity;
|
||||
}
|
||||
|
||||
SpriteBase* CreateEntityAt(const uint16_t index, const EntityType type)
|
||||
|
@ -444,88 +426,6 @@ SpriteBase* CreateEntityAt(const uint16_t index, const EntityType type)
|
|||
PrepareNewEntity(entity, type);
|
||||
return entity;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00673200
|
||||
*/
|
||||
void SteamParticle::Update()
|
||||
{
|
||||
// Move up 1 z every 3 ticks (Starts after 4 ticks)
|
||||
Invalidate();
|
||||
time_to_move++;
|
||||
if (time_to_move >= 4)
|
||||
{
|
||||
time_to_move = 1;
|
||||
MoveTo({ x, y, z + 1 });
|
||||
}
|
||||
frame += 64;
|
||||
if (frame >= (56 * 64))
|
||||
{
|
||||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0067363D
|
||||
*/
|
||||
void sprite_misc_explosion_cloud_create(const CoordsXYZ& cloudPos)
|
||||
{
|
||||
auto* sprite = CreateEntity<ExplosionCloud>();
|
||||
if (sprite != nullptr)
|
||||
{
|
||||
sprite->sprite_width = 44;
|
||||
sprite->sprite_height_negative = 32;
|
||||
sprite->sprite_height_positive = 34;
|
||||
sprite->MoveTo(cloudPos + CoordsXYZ{ 0, 0, 4 });
|
||||
sprite->frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00673385
|
||||
*/
|
||||
void ExplosionCloud::Update()
|
||||
{
|
||||
Invalidate();
|
||||
frame += 128;
|
||||
if (frame >= (36 * 128))
|
||||
{
|
||||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0067366B
|
||||
*/
|
||||
void sprite_misc_explosion_flare_create(const CoordsXYZ& flarePos)
|
||||
{
|
||||
MiscEntity* sprite = CreateEntity<ExplosionFlare>();
|
||||
if (sprite != nullptr)
|
||||
{
|
||||
sprite->sprite_width = 25;
|
||||
sprite->sprite_height_negative = 85;
|
||||
sprite->sprite_height_positive = 8;
|
||||
sprite->MoveTo(flarePos + CoordsXYZ{ 0, 0, 4 });
|
||||
sprite->frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006733B4
|
||||
*/
|
||||
void ExplosionFlare::Update()
|
||||
{
|
||||
Invalidate();
|
||||
frame += 64;
|
||||
if (frame >= (124 * 64))
|
||||
{
|
||||
sprite_remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void MiscUpdateAllType()
|
||||
{
|
||||
|
@ -808,112 +708,6 @@ uint16_t remove_floating_sprites()
|
|||
return removed;
|
||||
}
|
||||
|
||||
void EntityTweener::PopulateEntities()
|
||||
{
|
||||
for (auto ent : EntityList<Guest>())
|
||||
{
|
||||
Entities.push_back(ent);
|
||||
PrePos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
for (auto ent : EntityList<Staff>())
|
||||
{
|
||||
Entities.push_back(ent);
|
||||
PrePos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
for (auto ent : EntityList<Vehicle>())
|
||||
{
|
||||
Entities.push_back(ent);
|
||||
PrePos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::PreTick()
|
||||
{
|
||||
Restore();
|
||||
Reset();
|
||||
PopulateEntities();
|
||||
}
|
||||
|
||||
void EntityTweener::PostTick()
|
||||
{
|
||||
for (auto* ent : Entities)
|
||||
{
|
||||
if (ent == nullptr)
|
||||
{
|
||||
// Sprite was removed, add a dummy position to keep the index aligned.
|
||||
PostPos.emplace_back(0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
PostPos.emplace_back(ent->x, ent->y, ent->z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::RemoveEntity(SpriteBase* entity)
|
||||
{
|
||||
if (!entity->Is<Peep>() && !entity->Is<Vehicle>())
|
||||
{
|
||||
// Only peeps and vehicles are tweened, bail if type is incorrect.
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = std::find(Entities.begin(), Entities.end(), entity);
|
||||
if (it != Entities.end())
|
||||
*it = nullptr;
|
||||
}
|
||||
|
||||
void EntityTweener::Tween(float alpha)
|
||||
{
|
||||
const float inv = (1.0f - alpha);
|
||||
for (size_t i = 0; i < Entities.size(); ++i)
|
||||
{
|
||||
auto* ent = Entities[i];
|
||||
if (ent == nullptr)
|
||||
continue;
|
||||
|
||||
auto& posA = PrePos[i];
|
||||
auto& posB = PostPos[i];
|
||||
|
||||
if (posA == posB)
|
||||
continue;
|
||||
|
||||
sprite_set_coordinates(
|
||||
{ static_cast<int32_t>(std::round(posB.x * alpha + posA.x * inv)),
|
||||
static_cast<int32_t>(std::round(posB.y * alpha + posA.y * inv)),
|
||||
static_cast<int32_t>(std::round(posB.z * alpha + posA.z * inv)) },
|
||||
ent);
|
||||
ent->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::Restore()
|
||||
{
|
||||
for (size_t i = 0; i < Entities.size(); ++i)
|
||||
{
|
||||
auto* ent = Entities[i];
|
||||
if (ent == nullptr)
|
||||
continue;
|
||||
|
||||
sprite_set_coordinates(PostPos[i], ent);
|
||||
ent->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTweener::Reset()
|
||||
{
|
||||
Entities.clear();
|
||||
PrePos.clear();
|
||||
PostPos.clear();
|
||||
}
|
||||
|
||||
static EntityTweener tweener;
|
||||
|
||||
EntityTweener& EntityTweener::Get()
|
||||
{
|
||||
return tweener;
|
||||
}
|
||||
|
||||
void sprite_set_flashing(SpriteBase* sprite, bool flashing)
|
||||
{
|
||||
assert(sprite->sprite_index < MAX_ENTITIES);
|
||||
|
|
|
@ -14,32 +14,6 @@
|
|||
#include "SpriteBase.h"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
class DataSerialiser;
|
||||
|
||||
struct ExplosionFlare : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::ExplosionFlare;
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
struct ExplosionCloud : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::ExplosionCloud;
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
struct SteamParticle : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::SteamParticle;
|
||||
uint16_t time_to_move;
|
||||
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
/**
|
||||
|
@ -62,59 +36,16 @@ struct rct_sprite_checksum
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
enum
|
||||
{
|
||||
SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE = 1 << 7,
|
||||
SPRITE_FLAGS_PEEP_VISIBLE = 1 << 8, // Peep is eligible to show in summarized guest list window (is inside park?)
|
||||
SPRITE_FLAGS_PEEP_FLASHING = 1 << 9, // Deprecated: Use sprite_set_flashing/sprite_get_flashing instead.
|
||||
};
|
||||
|
||||
rct_sprite* create_sprite(EntityType type);
|
||||
template<typename T> T* CreateEntity()
|
||||
{
|
||||
return reinterpret_cast<T*>(create_sprite(T::cEntityType));
|
||||
}
|
||||
|
||||
// Use only with imports that must happen at a specified index
|
||||
SpriteBase* CreateEntityAt(const uint16_t index, const EntityType type);
|
||||
// Use only with imports that must happen at a specified index
|
||||
template<typename T> T* CreateEntityAt(const uint16_t index)
|
||||
{
|
||||
return static_cast<T*>(CreateEntityAt(index, T::cEntityType));
|
||||
}
|
||||
void reset_sprite_list();
|
||||
void reset_sprite_spatial_index();
|
||||
void sprite_clear_all_unused();
|
||||
void sprite_misc_update_all();
|
||||
void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite);
|
||||
void sprite_remove(SpriteBase* sprite);
|
||||
uint16_t remove_floating_sprites();
|
||||
void sprite_misc_explosion_cloud_create(const CoordsXYZ& cloudPos);
|
||||
void sprite_misc_explosion_flare_create(const CoordsXYZ& flarePos);
|
||||
|
||||
rct_sprite_checksum sprite_checksum();
|
||||
|
||||
void sprite_set_flashing(SpriteBase* sprite, bool flashing);
|
||||
bool sprite_get_flashing(SpriteBase* sprite);
|
||||
|
||||
class EntityTweener
|
||||
{
|
||||
std::vector<SpriteBase*> Entities;
|
||||
std::vector<CoordsXYZ> PrePos;
|
||||
std::vector<CoordsXYZ> PostPos;
|
||||
|
||||
private:
|
||||
void PopulateEntities();
|
||||
|
||||
public:
|
||||
static EntityTweener& Get();
|
||||
|
||||
void PreTick();
|
||||
void PostTick();
|
||||
void RemoveEntity(SpriteBase* entity);
|
||||
void Tween(float alpha);
|
||||
void Restore();
|
||||
void Reset();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <openrct2/peep/Peep.h>
|
||||
#include <openrct2/platform/platform.h>
|
||||
#include <openrct2/ride/Ride.h>
|
||||
#include <openrct2/world/EntityTweener.h>
|
||||
#include <openrct2/world/MapAnimation.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <openrct2/ride/Vehicle.h>
|
||||
#include <openrct2/world/Balloon.h>
|
||||
#include <openrct2/world/Duck.h>
|
||||
#include <openrct2/world/EntityTweener.h>
|
||||
#include <openrct2/world/Fountain.h>
|
||||
#include <openrct2/world/MoneyEffect.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
|
Loading…
Reference in New Issue