mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #14146 from janisozaur/reduce-includes
Reduce inclusion of Vehicle.h
This commit is contained in:
commit
6340b1248c
|
@ -286,7 +286,7 @@ static void window_editor_bottom_toolbar_mouseup([[maybe_unused]] rct_window* w,
|
|||
if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
|
||||
{
|
||||
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
|| (GetNumFreeEntities() == MAX_SPRITES && !(gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)))
|
||||
|| (GetNumFreeEntities() == MAX_ENTITIES && !(gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)))
|
||||
{
|
||||
previous_button_mouseup_events[EnumValue(gS6Info.editor_step)]();
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ void window_editor_bottom_toolbar_invalidate(rct_window* w)
|
|||
}
|
||||
else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER))
|
||||
{
|
||||
if (GetNumFreeEntities() != MAX_SPRITES || gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)
|
||||
if (GetNumFreeEntities() != MAX_ENTITIES || gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)
|
||||
{
|
||||
hide_previous_step_button();
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
drawPreviousButton = true;
|
||||
}
|
||||
else if (GetNumFreeEntities() != MAX_SPRITES)
|
||||
else if (GetNumFreeEntities() != MAX_ENTITIES)
|
||||
{
|
||||
drawNextButton = true;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/Track.h>
|
||||
#include <openrct2/world/EntityList.h>
|
||||
#include <openrct2/world/Entrance.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
|
|
@ -52,7 +52,9 @@
|
|||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#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;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/EntityList.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "ui/WindowManager.h"
|
||||
#include "util/Util.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Sprite.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "world/Footpath.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Scenery.h"
|
||||
#include "world/Sprite.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
@ -309,7 +310,7 @@ namespace Editor
|
|||
ride_init_all();
|
||||
|
||||
//
|
||||
for (int32_t i = 0; i < MAX_SPRITES; i++)
|
||||
for (int32_t i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
auto peep = GetEntity<Peep>(i);
|
||||
if (peep != nullptr)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "object/ObjectManager.h"
|
||||
#include "object/ObjectRepository.h"
|
||||
#include "ride/RideData.h"
|
||||
#include "ride/Vehicle.h"
|
||||
#include "scenario/Scenario.h"
|
||||
#include "windows/Intent.h"
|
||||
#include "world/Footpath.h"
|
||||
|
|
|
@ -588,7 +588,7 @@ void game_unload_scripts()
|
|||
*/
|
||||
void reset_all_sprite_quadrant_placements()
|
||||
{
|
||||
for (size_t i = 0; i < MAX_SPRITES; i++)
|
||||
for (size_t i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
auto* spr = GetEntity(i);
|
||||
if (spr != nullptr && spr->sprite_identifier != SpriteIdentifier::Null)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "world/MapAnimation.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Scenery.h"
|
||||
#include "world/Sprite.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "core/CircularBuffer.h"
|
||||
#include "peep/Peep.h"
|
||||
#include "world/EntityList.h"
|
||||
#include "world/Sprite.h"
|
||||
|
||||
static constexpr size_t MaximumGameStateSnapshots = 32;
|
||||
|
@ -145,7 +146,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
|
|||
virtual void Capture(GameStateSnapshot_t& snapshot) override final
|
||||
{
|
||||
snapshot.SerialiseSprites(
|
||||
[](const size_t index) { return reinterpret_cast<rct_sprite*>(GetEntity(index)); }, MAX_SPRITES, true);
|
||||
[](const size_t index) { return reinterpret_cast<rct_sprite*>(GetEntity(index)); }, MAX_ENTITIES, true);
|
||||
|
||||
// log_info("Snapshot size: %u bytes", static_cast<uint32_t>(snapshot.storedSprites.GetLength()));
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
|
|||
std::vector<rct_sprite> BuildSpriteList(GameStateSnapshot_t& snapshot) const
|
||||
{
|
||||
std::vector<rct_sprite> spriteList;
|
||||
spriteList.resize(MAX_SPRITES);
|
||||
spriteList.resize(MAX_ENTITIES);
|
||||
|
||||
for (auto& sprite : spriteList)
|
||||
{
|
||||
|
@ -179,7 +180,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
|
|||
sprite.misc.sprite_identifier = SpriteIdentifier::Null;
|
||||
}
|
||||
|
||||
snapshot.SerialiseSprites([&spriteList](const size_t index) { return &spriteList[index]; }, MAX_SPRITES, false);
|
||||
snapshot.SerialiseSprites([&spriteList](const size_t index) { return &spriteList[index]; }, MAX_ENTITIES, false);
|
||||
|
||||
return spriteList;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "object/ObjectRepository.h"
|
||||
#include "rct2/S6Exporter.h"
|
||||
#include "world/Park.h"
|
||||
#include "world/Sprite.h"
|
||||
#include "zlib.h"
|
||||
|
||||
#include <chrono>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "BalloonPressAction.h"
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
BalloonPressAction::BalloonPressAction(uint16_t spriteIndex)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(BalloonPressAction, GameCommand::BalloonPress, GameActions::Result)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../ui/WindowManager.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../Context.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../world/Entity.h"
|
||||
|
||||
GuestSetFlagsAction::GuestSetFlagsAction(uint16_t peepId, uint32_t flags)
|
||||
: _peepId(peepId)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(GuestSetFlagsAction, GameCommand::GuestSetFlags, GameActions::Result)
|
||||
|
|
|
@ -56,7 +56,7 @@ void GuestSetNameAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr GuestSetNameAction::Query() const
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
if (_spriteIndex >= MAX_ENTITIES)
|
||||
{
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_CANT_NAME_GUEST, STR_NONE);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(GuestSetNameAction, GameCommand::SetGuestName, GameActions::Result)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../Input.h"
|
||||
#include "../network/network.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
PeepPickupAction::PeepPickupAction(PeepPickupType type, uint32_t spriteId, const CoordsXYZ& loc, NetworkPlayerId_t owner)
|
||||
: _type(type)
|
||||
|
@ -35,7 +36,7 @@ void PeepPickupAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr PeepPickupAction::Query() const
|
||||
{
|
||||
if (_spriteId >= MAX_SPRITES || _spriteId == SPRITE_INDEX_NULL)
|
||||
if (_spriteId >= MAX_ENTITIES || _spriteId == SPRITE_INDEX_NULL)
|
||||
{
|
||||
log_error("Failed to pick up peep for sprite %d", _spriteId);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
enum class PeepPickupType : uint8_t
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "MazeSetTrackAction.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../interface/Window.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../world/Entity.h"
|
||||
|
||||
StaffFireAction::StaffFireAction(uint16_t spriteId)
|
||||
: _spriteId(spriteId)
|
||||
|
@ -30,7 +31,7 @@ void StaffFireAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr StaffFireAction::Query() const
|
||||
{
|
||||
if (_spriteId >= MAX_SPRITES)
|
||||
if (_spriteId >= MAX_ENTITIES)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffFireAction, GameCommand::FireStaffMember, GameActions::Result)
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../peep/Staff.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
/* rct2: 0x009929FC */
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
StaffSetColourAction::StaffSetColourAction(StaffType staffType, uint8_t colour)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/Entity.h"
|
||||
|
||||
/** rct2: 0x00982134 */
|
||||
constexpr const bool peep_slow_walking_types[] = {
|
||||
|
@ -55,7 +56,7 @@ void StaffSetCostumeAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr StaffSetCostumeAction::Query() const
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
if (_spriteIndex >= MAX_ENTITIES)
|
||||
{
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../peep/Staff.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetCostumeAction, GameCommand::SetStaffCostume, GameActions::Result)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "../localisation/StringIds.h"
|
||||
#include "../peep/Staff.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/Entity.h"
|
||||
#include "../world/Park.h"
|
||||
|
||||
StaffSetNameAction::StaffSetNameAction(uint16_t spriteIndex, const std::string& name)
|
||||
|
@ -40,7 +41,7 @@ void StaffSetNameAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr StaffSetNameAction::Query() const
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
if (_spriteIndex >= MAX_ENTITIES)
|
||||
{
|
||||
return std::make_unique<GameActions::Result>(
|
||||
GameActions::Status::InvalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_NONE);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetNameAction, GameCommand::SetStaffName, GameActions::Result)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../localisation/StringIds.h"
|
||||
#include "../peep/Staff.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/Entity.h"
|
||||
|
||||
StaffSetOrdersAction::StaffSetOrdersAction(uint16_t spriteIndex, uint8_t ordersId)
|
||||
: _spriteIndex(spriteIndex)
|
||||
|
@ -36,7 +37,7 @@ void StaffSetOrdersAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr StaffSetOrdersAction::Query() const
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
if (_spriteIndex >= MAX_ENTITIES)
|
||||
{
|
||||
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetOrdersAction, GameCommand::SetStaffOrders, GameActions::Result)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../interface/Window.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../peep/Staff.h"
|
||||
#include "../world/Entity.h"
|
||||
|
||||
StaffSetPatrolAreaAction::StaffSetPatrolAreaAction(uint16_t spriteId, const CoordsXY& loc)
|
||||
: _spriteId(spriteId)
|
||||
|
@ -32,7 +33,7 @@ void StaffSetPatrolAreaAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result::Ptr StaffSetPatrolAreaAction::Query() const
|
||||
{
|
||||
if (_spriteId >= MAX_SPRITES)
|
||||
if (_spriteId >= MAX_ENTITIES)
|
||||
{
|
||||
log_error("Invalid spriteId. spriteId = %u", _spriteId);
|
||||
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetPatrolAreaAction, GameCommand::SetStaffPatrol, GameActions::Result)
|
||||
|
|
|
@ -145,6 +145,8 @@ using money64 = fixed64_1dp;
|
|||
using EMPTY_ARGS_VOID_POINTER = void();
|
||||
using rct_string_id = uint16_t;
|
||||
|
||||
constexpr uint16_t SPRITE_INDEX_NULL = 0xFFFF;
|
||||
|
||||
#define SafeFree(x) \
|
||||
do \
|
||||
{ \
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "../util/Util.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
@ -1265,7 +1266,7 @@ static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] cons
|
|||
}
|
||||
}
|
||||
|
||||
console.WriteFormatLine("Sprites: %d/%d", spriteCount, MAX_SPRITES);
|
||||
console.WriteFormatLine("Sprites: %d/%d", spriteCount, MAX_ENTITIES);
|
||||
console.WriteFormatLine("Map Elements: %d/%d", tileElementCount, MAX_TILE_ELEMENTS);
|
||||
console.WriteFormatLine("Banners: %d/%zu", bannerCount, MAX_BANNERS);
|
||||
console.WriteFormatLine("Rides: %d/%d", rideCount, MAX_RIDES);
|
||||
|
@ -1588,7 +1589,7 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
|||
|
||||
std::vector<Peep*> peeps;
|
||||
|
||||
for (int i = 0; i < MAX_SPRITES; i++)
|
||||
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
auto* sprite = GetEntity(i);
|
||||
if (sprite == nullptr || sprite->sprite_identifier == SpriteIdentifier::Null)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Colour.h"
|
||||
|
|
|
@ -2141,7 +2141,7 @@ void window_init_all()
|
|||
|
||||
void window_follow_sprite(rct_window* w, size_t spriteIndex)
|
||||
{
|
||||
if (spriteIndex < MAX_SPRITES || spriteIndex == SPRITE_INDEX_NULL)
|
||||
if (spriteIndex < MAX_ENTITIES || spriteIndex == SPRITE_INDEX_NULL)
|
||||
{
|
||||
w->viewport_smart_follow_sprite = static_cast<uint16_t>(spriteIndex);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "Window_internal.h"
|
||||
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
void rct_window::SetLocation(const CoordsXYZ& coords)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Sprite.h"
|
||||
#include "Window.h"
|
||||
|
||||
#include <list>
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../util/SawyerCoding.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/Sprite.h"
|
||||
#include "network.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "../common.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "../ride/RideData.h"
|
||||
#include "../ride/ShopItem.h"
|
||||
#include "../ride/Track.h"
|
||||
#include "../ride/Vehicle.h"
|
||||
#include "ObjectRepository.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "../../ride/RideData.h"
|
||||
#include "../../ride/TrackDesign.h"
|
||||
#include "../../ride/VehiclePaint.h"
|
||||
#include "../../world/EntityList.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Paint.h"
|
||||
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
#define _PAINT_SPRITE_H
|
||||
|
||||
#include "../../common.h"
|
||||
#include "../../world/Sprite.h"
|
||||
|
||||
struct paint_session;
|
||||
struct Litter;
|
||||
struct MiscEntity;
|
||||
struct Peep;
|
||||
|
||||
void sprite_paint_setup(paint_session* session, const uint16_t x, const uint16_t y);
|
||||
|
||||
|
|
|
@ -593,7 +593,7 @@ struct Peep : SpriteBase
|
|||
uint8_t Toilet;
|
||||
uint8_t Mass;
|
||||
uint8_t TimeToConsume;
|
||||
IntensityRange Intensity;
|
||||
IntensityRange Intensity{ 0 };
|
||||
PeepNauseaTolerance NauseaTolerance;
|
||||
uint8_t WindowInvalidateFlags;
|
||||
money16 PaidOnDrink;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
# include "platform.h"
|
||||
|
||||
# include <algorithm>
|
||||
# include <array>
|
||||
# include <iterator>
|
||||
# include <lmcons.h>
|
||||
# include <memory>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "../world/Banner.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
constexpr const uint16_t RCT1_MAX_TILE_ELEMENTS = 0xC000;
|
||||
constexpr const uint16_t RCT1_MAX_SPRITES = 5000;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "../world/Park.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/SmallScenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "RCT1.h"
|
||||
|
@ -1355,7 +1356,7 @@ private:
|
|||
ImportPeep(peep, srcPeep);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < MAX_SPRITES; i++)
|
||||
for (size_t i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
auto vehicle = GetEntity<Vehicle>(i);
|
||||
if (vehicle != nullptr)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../object/Object.h"
|
||||
#include "../rct12/RCT12.h"
|
||||
#include "../ride/RideRatings.h"
|
||||
#include "../ride/Vehicle.h"
|
||||
#include "../ride/VehicleColour.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -90,6 +90,8 @@ constexpr const int32_t rct2_object_entry_group_counts[] = {
|
|||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct rct_ride_entry;
|
||||
|
||||
/**
|
||||
* Ride structure.
|
||||
* size: 0x0260
|
||||
|
|
|
@ -23,8 +23,10 @@ namespace OpenRCT2
|
|||
struct IStream;
|
||||
}
|
||||
|
||||
struct Litter;
|
||||
struct ObjectRepositoryItem;
|
||||
struct RCT12SpriteBase;
|
||||
union rct_sprite;
|
||||
struct SpriteBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../audio/audio.h"
|
||||
#include "../rct12/RCT12.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Ride.h"
|
||||
#include "RideData.h"
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#define _CABLE_LIFT_H_
|
||||
|
||||
#include "../common.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Ride.h"
|
||||
|
||||
struct Vehicle;
|
||||
|
||||
Vehicle* cable_lift_segment_create(
|
||||
Ride& ride, int32_t x, int32_t y, int32_t z, int32_t direction, uint16_t var_44, int32_t remaining_distance, bool head);
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "Track.h"
|
||||
#include "TrackData.h"
|
||||
#include "TrackDesign.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "RideRatings.h"
|
||||
#include "RideTypes.h"
|
||||
#include "ShopItem.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VehicleEntry.h"
|
||||
|
||||
#include <limits>
|
||||
#include <string_view>
|
||||
|
@ -30,6 +30,7 @@ struct Peep;
|
|||
struct Ride;
|
||||
struct RideTypeDescriptor;
|
||||
struct Staff;
|
||||
struct Vehicle;
|
||||
|
||||
#define MAX_RIDE_TYPES_PER_RIDE_ENTRY 3
|
||||
// The max number of different types of vehicle.
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "Ride.h"
|
||||
#include "ShopItem.h"
|
||||
#include "Track.h"
|
||||
#include "Vehicle.h"
|
||||
#include "coaster/meta/AirPoweredVerticalCoaster.h"
|
||||
#include "coaster/meta/BobsleighCoaster.h"
|
||||
#include "coaster/meta/ClassicMiniRollerCoaster.h"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define DEFAULT_FLAT_RIDE_COLOUR_PRESET TRACK_COLOUR_PRESETS({ COLOUR_BRIGHT_RED, COLOUR_LIGHT_BLUE, COLOUR_YELLOW })
|
||||
#define DEFAULT_STALL_COLOUR_PRESET TRACK_COLOUR_PRESETS({ COLOUR_BRIGHT_RED, COLOUR_BRIGHT_RED, COLOUR_BRIGHT_RED })
|
||||
|
||||
#include "../audio/audio.h"
|
||||
#include "../common.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../sprites.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../common.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
ShopItem& operator++(ShopItem& d, int)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "Track.h"
|
||||
#include "TrackData.h"
|
||||
#include "TrackDesignRepository.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "../rct12/RCT12.h"
|
||||
#include "../rct2/RCT2.h"
|
||||
#include "../world/Map.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
struct Ride;
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#include "../world/Location.hpp"
|
||||
#include "../world/SpriteBase.h"
|
||||
#include "Station.h"
|
||||
#include "VehicleColour.h"
|
||||
#include "VehicleEntry.h"
|
||||
#include "VehicleSubpositionData.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
@ -23,118 +26,6 @@
|
|||
|
||||
using track_type_t = uint16_t;
|
||||
|
||||
struct rct_vehicle_colour
|
||||
{
|
||||
uint8_t body_colour;
|
||||
uint8_t trim_colour;
|
||||
};
|
||||
|
||||
struct VehicleColour
|
||||
{
|
||||
uint8_t Body;
|
||||
uint8_t Trim;
|
||||
uint8_t Ternary;
|
||||
};
|
||||
|
||||
#ifdef __TESTPAINT__
|
||||
# pragma pack(push, 1)
|
||||
#endif // __TESTPAINT__
|
||||
/**
|
||||
* Ride type vehicle structure.
|
||||
* size: 0x65
|
||||
*/
|
||||
struct rct_ride_entry_vehicle
|
||||
{
|
||||
uint16_t rotation_frame_mask; // 0x00 , 0x1A
|
||||
uint8_t num_vertical_frames; // 0x02 , 0x1C, Appears to be unused, except as a temporary variable in RCT2 (not needed for
|
||||
// OpenRCT2)
|
||||
uint8_t num_horizontal_frames; // 0x03 , 0x1D, Appears to be unused, except as a temporary variable in RCT2 (not needed for
|
||||
// OpenRCT2)
|
||||
uint32_t spacing; // 0x04 , 0x1E
|
||||
uint16_t car_mass; // 0x08 , 0x22
|
||||
int8_t tab_height; // 0x0A , 0x24
|
||||
uint8_t num_seats; // 0x0B , 0x25
|
||||
uint16_t sprite_flags; // 0x0C , 0x26
|
||||
uint8_t sprite_width; // 0x0E , 0x28
|
||||
uint8_t sprite_height_negative; // 0x0F , 0x29
|
||||
uint8_t sprite_height_positive; // 0x10 , 0x2A
|
||||
uint8_t animation; // 0x11 , 0x2B
|
||||
uint32_t flags; // 0x12 , 0x2C
|
||||
uint16_t base_num_frames; // 0x16 , 0x30, The number of sprites for a flat non-banked track piece.
|
||||
uint32_t base_image_id; // 0x18 , 0x32, Following image_id's populated during loading
|
||||
uint32_t restraint_image_id; // 0x1C , 0x36
|
||||
uint32_t gentle_slope_image_id; // 0x20 , 0x3A
|
||||
uint32_t steep_slope_image_id; // 0x24 , 0x3E
|
||||
uint32_t vertical_slope_image_id; // 0x28 , 0x42
|
||||
uint32_t diagonal_slope_image_id; // 0x2C , 0x46
|
||||
uint32_t banked_image_id; // 0x30 , 0x4A
|
||||
uint32_t inline_twist_image_id; // 0x34 , 0x4E
|
||||
uint32_t flat_to_gentle_bank_image_id; // 0x38 , 0x52
|
||||
uint32_t diagonal_to_gentle_slope_bank_image_id; // 0x3C , 0x56
|
||||
uint32_t gentle_slope_to_bank_image_id; // 0x40 , 0x5A
|
||||
uint32_t gentle_slope_bank_turn_image_id; // 0x44 , 0x5E
|
||||
uint32_t flat_bank_to_gentle_slope_image_id; // 0x48 , 0x62
|
||||
union
|
||||
{
|
||||
uint32_t curved_lift_hill_image_id; // 0x4C , 0x66
|
||||
uint32_t corkscrew_image_id; // 0x4C , 0x66
|
||||
};
|
||||
uint32_t no_vehicle_images; // 0x50 , 0x6A
|
||||
uint8_t no_seating_rows; // 0x54 , 0x6E
|
||||
uint8_t spinning_inertia; // 0x55 , 0x6F
|
||||
uint8_t spinning_friction; // 0x56 , 0x70
|
||||
OpenRCT2::Audio::SoundId friction_sound_id; // 0x57 , 0x71
|
||||
uint8_t log_flume_reverser_vehicle_type; // 0x58 , 0x72
|
||||
uint8_t sound_range; // 0x59 , 0x73
|
||||
uint8_t
|
||||
double_sound_frequency; // 0x5A , 0x74 (Doubles the velocity when working out the sound frequency {used on go karts})
|
||||
uint8_t powered_acceleration; // 0x5B , 0x75
|
||||
uint8_t powered_max_speed; // 0x5C , 0x76
|
||||
uint8_t car_visual; // 0x5D , 0x77
|
||||
uint8_t effect_visual;
|
||||
uint8_t draw_order;
|
||||
uint8_t num_vertical_frames_override; // 0x60 , 0x7A, A custom number that can be used rather than letting RCT2 determine
|
||||
// it. Needs the VEHICLE_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES flag to be set.
|
||||
uint8_t peep_loading_waypoint_segments; // 0x61 new
|
||||
uint8_t pad_62[6] = {}; // 0x62 , 0x7B
|
||||
std::vector<std::array<CoordsXY, 3>> peep_loading_waypoints = {};
|
||||
std::vector<int8_t> peep_loading_positions = {}; // previously 0x61 , 0x7B
|
||||
};
|
||||
#ifdef __TESTPAINT__
|
||||
# pragma pack(pop)
|
||||
#endif // __TESTPAINT__
|
||||
#ifdef PLATFORM_32BIT
|
||||
static_assert(sizeof(rct_ride_entry_vehicle) % 4 == 0, "Invalid struct size");
|
||||
#else
|
||||
static_assert(sizeof(rct_ride_entry_vehicle) % 8 == 0, "Invalid struct size");
|
||||
#endif
|
||||
|
||||
enum class VehicleTrackSubposition : uint8_t
|
||||
{
|
||||
Default,
|
||||
// Going out means "moving away from the start". Viewed from Station 1, this is the left hand side of the track.
|
||||
ChairliftGoingOut,
|
||||
ChairliftGoingBack,
|
||||
// End and start bullwheel as viewed from Station 1.
|
||||
ChairliftEndBullwheel,
|
||||
ChairliftStartBullwheel,
|
||||
GoKartsLeftLane,
|
||||
GoKartsRightLane,
|
||||
GoKartsMovingToRightLane,
|
||||
GoKartsMovingToLeftLane,
|
||||
MiniGolfStart9 = 9,
|
||||
MiniGolfPathA9 = 9,
|
||||
MiniGolfBallPathA10,
|
||||
MiniGolfPathB11,
|
||||
MiniGolfBallPathB12,
|
||||
MiniGolfPathC13,
|
||||
MiniGolfBallPathC14,
|
||||
ReverserRCFrontBogie,
|
||||
ReverserRCRearBogie,
|
||||
|
||||
Count,
|
||||
};
|
||||
|
||||
struct Ride;
|
||||
struct rct_ride_entry;
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*****************************************************************************
|
||||
* 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 "../common.h"
|
||||
|
||||
struct rct_vehicle_colour
|
||||
{
|
||||
uint8_t body_colour;
|
||||
uint8_t trim_colour;
|
||||
};
|
||||
|
||||
struct VehicleColour
|
||||
{
|
||||
uint8_t Body;
|
||||
uint8_t Trim;
|
||||
uint8_t Ternary;
|
||||
};
|
|
@ -0,0 +1,89 @@
|
|||
/*****************************************************************************
|
||||
* 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 "../audio/AudioMixer.h"
|
||||
#include "../common.h"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __TESTPAINT__
|
||||
# pragma pack(push, 1)
|
||||
#endif // __TESTPAINT__
|
||||
/**
|
||||
* Ride type vehicle structure.
|
||||
* size: 0x65
|
||||
*/
|
||||
struct rct_ride_entry_vehicle
|
||||
{
|
||||
uint16_t rotation_frame_mask; // 0x00 , 0x1A
|
||||
uint8_t num_vertical_frames; // 0x02 , 0x1C, Appears to be unused, except as a temporary variable in RCT2 (not needed for
|
||||
// OpenRCT2)
|
||||
uint8_t num_horizontal_frames; // 0x03 , 0x1D, Appears to be unused, except as a temporary variable in RCT2 (not needed for
|
||||
// OpenRCT2)
|
||||
uint32_t spacing; // 0x04 , 0x1E
|
||||
uint16_t car_mass; // 0x08 , 0x22
|
||||
int8_t tab_height; // 0x0A , 0x24
|
||||
uint8_t num_seats; // 0x0B , 0x25
|
||||
uint16_t sprite_flags; // 0x0C , 0x26
|
||||
uint8_t sprite_width; // 0x0E , 0x28
|
||||
uint8_t sprite_height_negative; // 0x0F , 0x29
|
||||
uint8_t sprite_height_positive; // 0x10 , 0x2A
|
||||
uint8_t animation; // 0x11 , 0x2B
|
||||
uint32_t flags; // 0x12 , 0x2C
|
||||
uint16_t base_num_frames; // 0x16 , 0x30, The number of sprites for a flat non-banked track piece.
|
||||
uint32_t base_image_id; // 0x18 , 0x32, Following image_id's populated during loading
|
||||
uint32_t restraint_image_id; // 0x1C , 0x36
|
||||
uint32_t gentle_slope_image_id; // 0x20 , 0x3A
|
||||
uint32_t steep_slope_image_id; // 0x24 , 0x3E
|
||||
uint32_t vertical_slope_image_id; // 0x28 , 0x42
|
||||
uint32_t diagonal_slope_image_id; // 0x2C , 0x46
|
||||
uint32_t banked_image_id; // 0x30 , 0x4A
|
||||
uint32_t inline_twist_image_id; // 0x34 , 0x4E
|
||||
uint32_t flat_to_gentle_bank_image_id; // 0x38 , 0x52
|
||||
uint32_t diagonal_to_gentle_slope_bank_image_id; // 0x3C , 0x56
|
||||
uint32_t gentle_slope_to_bank_image_id; // 0x40 , 0x5A
|
||||
uint32_t gentle_slope_bank_turn_image_id; // 0x44 , 0x5E
|
||||
uint32_t flat_bank_to_gentle_slope_image_id; // 0x48 , 0x62
|
||||
union
|
||||
{
|
||||
uint32_t curved_lift_hill_image_id; // 0x4C , 0x66
|
||||
uint32_t corkscrew_image_id; // 0x4C , 0x66
|
||||
};
|
||||
uint32_t no_vehicle_images; // 0x50 , 0x6A
|
||||
uint8_t no_seating_rows; // 0x54 , 0x6E
|
||||
uint8_t spinning_inertia; // 0x55 , 0x6F
|
||||
uint8_t spinning_friction; // 0x56 , 0x70
|
||||
OpenRCT2::Audio::SoundId friction_sound_id; // 0x57 , 0x71
|
||||
uint8_t log_flume_reverser_vehicle_type; // 0x58 , 0x72
|
||||
uint8_t sound_range; // 0x59 , 0x73
|
||||
uint8_t
|
||||
double_sound_frequency; // 0x5A , 0x74 (Doubles the velocity when working out the sound frequency {used on go karts})
|
||||
uint8_t powered_acceleration; // 0x5B , 0x75
|
||||
uint8_t powered_max_speed; // 0x5C , 0x76
|
||||
uint8_t car_visual; // 0x5D , 0x77
|
||||
uint8_t effect_visual;
|
||||
uint8_t draw_order;
|
||||
uint8_t num_vertical_frames_override; // 0x60 , 0x7A, A custom number that can be used rather than letting RCT2 determine
|
||||
// it. Needs the VEHICLE_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES flag to be set.
|
||||
uint8_t peep_loading_waypoint_segments; // 0x61 new
|
||||
uint8_t pad_62[6] = {}; // 0x62 , 0x7B
|
||||
std::vector<std::array<CoordsXY, 3>> peep_loading_waypoints = {};
|
||||
std::vector<int8_t> peep_loading_positions = {}; // previously 0x61 , 0x7B
|
||||
};
|
||||
#ifdef __TESTPAINT__
|
||||
# pragma pack(pop)
|
||||
#endif // __TESTPAINT__
|
||||
#ifdef PLATFORM_32BIT
|
||||
static_assert(sizeof(rct_ride_entry_vehicle) % 4 == 0, "Invalid struct size");
|
||||
#else
|
||||
static_assert(sizeof(rct_ride_entry_vehicle) % 8 == 0, "Invalid struct size");
|
||||
#endif
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "VehicleSubpositionData.h"
|
||||
|
||||
#include "Vehicle.h"
|
||||
|
||||
#define CREATE_VEHICLE_INFO(VAR, ...) \
|
||||
static constexpr const rct_vehicle_info VAR##_data[] = __VA_ARGS__; \
|
||||
static constexpr const rct_vehicle_info_list VAR = { static_cast<uint16_t>(std::size(VAR##_data)), VAR##_data };
|
||||
|
|
|
@ -9,14 +9,40 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../world/Location.hpp"
|
||||
#include "Track.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
constexpr const size_t VehicleTrackSubpositionSizeDefault = TrackElemType::Count * NumOrthogonalDirections;
|
||||
|
||||
struct rct_vehicle_info;
|
||||
|
||||
enum class VehicleTrackSubposition : uint8_t
|
||||
{
|
||||
Default,
|
||||
// Going out means "moving away from the start". Viewed from Station 1, this is the left hand side of the track.
|
||||
ChairliftGoingOut,
|
||||
ChairliftGoingBack,
|
||||
// End and start bullwheel as viewed from Station 1.
|
||||
ChairliftEndBullwheel,
|
||||
ChairliftStartBullwheel,
|
||||
GoKartsLeftLane,
|
||||
GoKartsRightLane,
|
||||
GoKartsMovingToRightLane,
|
||||
GoKartsMovingToLeftLane,
|
||||
MiniGolfStart9 = 9,
|
||||
MiniGolfPathA9 = 9,
|
||||
MiniGolfBallPathA10,
|
||||
MiniGolfPathB11,
|
||||
MiniGolfBallPathB12,
|
||||
MiniGolfPathC13,
|
||||
MiniGolfBallPathC14,
|
||||
ReverserRCFrontBogie,
|
||||
ReverserRCRearBogie,
|
||||
|
||||
Count,
|
||||
};
|
||||
|
||||
struct rct_vehicle_info_list
|
||||
{
|
||||
uint16_t size;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../../paint/Supports.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
#include "../Vehicle.h"
|
||||
#include "../VehiclePaint.h"
|
||||
|
||||
// 0x009927E6:
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../../world/Map.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
#include "../Vehicle.h"
|
||||
#include "../VehiclePaint.h"
|
||||
|
||||
enum
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../../paint/Supports.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
#include "../Vehicle.h"
|
||||
#include "../VehiclePaint.h"
|
||||
|
||||
#include <cstring>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../RideData.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPaint.h"
|
||||
#include "../Vehicle.h"
|
||||
#include "../VehiclePaint.h"
|
||||
|
||||
#ifndef NO_VEHICLES
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include "../ride/RideRatings.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/EntityList.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Sprite.h"
|
||||
|
||||
using random_engine_t = Random::Rct2::Engine;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
# include "../peep/Peep.h"
|
||||
# include "../peep/Staff.h"
|
||||
# include "../util/Util.h"
|
||||
# include "../world/EntityList.h"
|
||||
# include "../world/Sprite.h"
|
||||
# include "Duktape.hpp"
|
||||
# include "ScRide.hpp"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
# include "../common.h"
|
||||
# include "../ride/Ride.h"
|
||||
# include "../world/EntityList.h"
|
||||
# include "../world/Map.h"
|
||||
# include "Duktape.hpp"
|
||||
# include "ScEntity.hpp"
|
||||
|
@ -50,7 +51,7 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
int32_t numEntities_get() const
|
||||
{
|
||||
return MAX_SPRITES;
|
||||
return MAX_ENTITIES;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<ScRide>> rides_get() const
|
||||
|
@ -83,7 +84,7 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
DukValue getEntity(int32_t id) const
|
||||
{
|
||||
if (id >= 0 && id < MAX_SPRITES)
|
||||
if (id >= 0 && id < MAX_ENTITIES)
|
||||
{
|
||||
auto spriteId = static_cast<uint16_t>(id);
|
||||
auto sprite = GetEntity(spriteId);
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*****************************************************************************
|
||||
* 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"
|
||||
|
||||
constexpr uint16_t MAX_ENTITIES = 10000;
|
||||
|
||||
SpriteBase* try_get_sprite(size_t spriteIndex);
|
||||
SpriteBase* get_sprite(size_t sprite_idx);
|
||||
|
||||
template<typename T = SpriteBase> T* GetEntity(size_t sprite_idx)
|
||||
{
|
||||
auto spr = get_sprite(sprite_idx);
|
||||
return spr != nullptr ? spr->As<T>() : nullptr;
|
||||
}
|
||||
|
||||
template<typename T = SpriteBase> T* TryGetEntity(size_t sprite_idx)
|
||||
{
|
||||
auto spr = try_get_sprite(sprite_idx);
|
||||
return spr != nullptr ? spr->As<T>() : nullptr;
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/*****************************************************************************
|
||||
* 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 "../common.h"
|
||||
#include "../rct12/RCT12.h"
|
||||
#include "Entity.h"
|
||||
#include "Location.hpp"
|
||||
#include "SpriteBase.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
enum class EntityListId : uint8_t
|
||||
{
|
||||
Free,
|
||||
TrainHead,
|
||||
Peep,
|
||||
Misc,
|
||||
Litter,
|
||||
Vehicle,
|
||||
Count,
|
||||
};
|
||||
|
||||
const std::list<uint16_t>& GetEntityList(const EntityListId id);
|
||||
|
||||
uint16_t GetEntityListCount(EntityListId list);
|
||||
uint16_t GetNumFreeEntities();
|
||||
void RebuildEntityLists();
|
||||
const std::vector<uint16_t>& GetEntityTileList(const CoordsXY& spritePos);
|
||||
|
||||
template<typename T, uint16_t SpriteBase::*NextList> class EntityIterator
|
||||
{
|
||||
private:
|
||||
T* Entity = nullptr;
|
||||
uint16_t NextEntityId = SPRITE_INDEX_NULL;
|
||||
|
||||
public:
|
||||
EntityIterator(const uint16_t _EntityId)
|
||||
: NextEntityId(_EntityId)
|
||||
{
|
||||
++(*this);
|
||||
}
|
||||
EntityIterator& operator++()
|
||||
{
|
||||
Entity = nullptr;
|
||||
|
||||
while (NextEntityId != SPRITE_INDEX_NULL && Entity == nullptr)
|
||||
{
|
||||
auto baseEntity = GetEntity(NextEntityId);
|
||||
if (!baseEntity)
|
||||
{
|
||||
NextEntityId = SPRITE_INDEX_NULL;
|
||||
continue;
|
||||
}
|
||||
NextEntityId = baseEntity->*NextList;
|
||||
Entity = baseEntity->template As<T>();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
EntityIterator operator++(int)
|
||||
{
|
||||
EntityIterator retval = *this;
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
bool operator==(EntityIterator other) const
|
||||
{
|
||||
return Entity == other.Entity;
|
||||
}
|
||||
bool operator!=(EntityIterator other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
T* operator*()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
// iterator traits
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = T;
|
||||
using pointer = const T*;
|
||||
using reference = const T&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
};
|
||||
|
||||
template<typename T> class EntityTileIterator
|
||||
{
|
||||
private:
|
||||
std::vector<uint16_t>::const_iterator iter;
|
||||
std::vector<uint16_t>::const_iterator end;
|
||||
T* Entity = nullptr;
|
||||
|
||||
public:
|
||||
EntityTileIterator(std::vector<uint16_t>::const_iterator _iter, std::vector<uint16_t>::const_iterator _end)
|
||||
: iter(_iter)
|
||||
, end(_end)
|
||||
{
|
||||
++(*this);
|
||||
}
|
||||
EntityTileIterator& operator++()
|
||||
{
|
||||
Entity = nullptr;
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = GetEntity<T>(*iter++);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
EntityTileIterator operator++(int)
|
||||
{
|
||||
EntityTileIterator retval = *this;
|
||||
++(*this);
|
||||
return *iter;
|
||||
}
|
||||
bool operator==(EntityTileIterator other) const
|
||||
{
|
||||
return Entity == other.Entity;
|
||||
}
|
||||
bool operator!=(EntityTileIterator other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
T* operator*()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
// iterator traits
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = T;
|
||||
using pointer = const T*;
|
||||
using reference = const T&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
};
|
||||
|
||||
template<typename T = SpriteBase> class EntityTileList
|
||||
{
|
||||
private:
|
||||
const std::vector<uint16_t>& vec;
|
||||
|
||||
public:
|
||||
EntityTileList(const CoordsXY& loc)
|
||||
: vec(GetEntityTileList(loc))
|
||||
{
|
||||
}
|
||||
|
||||
EntityTileIterator<T> begin()
|
||||
{
|
||||
return EntityTileIterator<T>(std::begin(vec), std::end(vec));
|
||||
}
|
||||
EntityTileIterator<T> end()
|
||||
{
|
||||
return EntityTileIterator<T>(std::end(vec), std::end(vec));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> class EntityListIterator
|
||||
{
|
||||
private:
|
||||
std::list<uint16_t>::const_iterator iter;
|
||||
std::list<uint16_t>::const_iterator end;
|
||||
T* Entity = nullptr;
|
||||
|
||||
public:
|
||||
EntityListIterator(std::list<uint16_t>::const_iterator _iter, std::list<uint16_t>::const_iterator _end)
|
||||
: iter(_iter)
|
||||
, end(_end)
|
||||
{
|
||||
++(*this);
|
||||
}
|
||||
EntityListIterator& operator++()
|
||||
{
|
||||
Entity = nullptr;
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = GetEntity<T>(*iter++);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
EntityListIterator operator++(int)
|
||||
{
|
||||
EntityListIterator retval = *this;
|
||||
++(*this);
|
||||
return *iter;
|
||||
}
|
||||
bool operator==(EntityListIterator other) const
|
||||
{
|
||||
return Entity == other.Entity;
|
||||
}
|
||||
bool operator!=(EntityListIterator other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
T* operator*()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
// iterator traits
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = T;
|
||||
using pointer = const T*;
|
||||
using reference = const T&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
};
|
||||
|
||||
template<typename T = SpriteBase> class EntityList
|
||||
{
|
||||
private:
|
||||
using EntityListIterator_t = EntityListIterator<T>;
|
||||
const std::list<uint16_t>& vec;
|
||||
|
||||
public:
|
||||
EntityList(EntityListId type)
|
||||
: vec(GetEntityList(type))
|
||||
{
|
||||
}
|
||||
|
||||
EntityListIterator_t begin()
|
||||
{
|
||||
return EntityListIterator_t(std::cbegin(vec), std::cend(vec));
|
||||
}
|
||||
EntityListIterator_t end()
|
||||
{
|
||||
return EntityListIterator_t(std::cend(vec), std::cend(vec));
|
||||
}
|
||||
};
|
|
@ -28,6 +28,7 @@
|
|||
#include "../ride/Track.h"
|
||||
#include "../ride/TrackData.h"
|
||||
#include "../util/Util.h"
|
||||
#include "EntityList.h"
|
||||
#include "Map.h"
|
||||
#include "MapAnimation.h"
|
||||
#include "Park.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "../ride/Track.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "Banner.h"
|
||||
#include "EntityList.h"
|
||||
#include "Footpath.h"
|
||||
#include "LargeScenery.h"
|
||||
#include "Map.h"
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
static rct_sprite _spriteList[MAX_SPRITES];
|
||||
static rct_sprite _spriteList[MAX_ENTITIES];
|
||||
static std::array<std::list<uint16_t>, EnumValue(EntityListId::Count)> gEntityLists;
|
||||
static std::vector<uint16_t> _freeIdList;
|
||||
|
||||
static bool _spriteFlashingList[MAX_SPRITES];
|
||||
static bool _spriteFlashingList[MAX_ENTITIES];
|
||||
|
||||
static std::array<std::vector<uint16_t>, SPATIAL_INDEX_SIZE> gSpriteSpatialIndex;
|
||||
|
||||
|
@ -128,7 +128,7 @@ std::string rct_sprite_checksum::ToString() const
|
|||
|
||||
SpriteBase* try_get_sprite(size_t spriteIndex)
|
||||
{
|
||||
return spriteIndex >= MAX_SPRITES ? nullptr : &_spriteList[spriteIndex].misc;
|
||||
return spriteIndex >= MAX_ENTITIES ? nullptr : &_spriteList[spriteIndex].misc;
|
||||
}
|
||||
|
||||
SpriteBase* get_sprite(size_t spriteIndex)
|
||||
|
@ -137,7 +137,7 @@ SpriteBase* get_sprite(size_t spriteIndex)
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
openrct2_assert(spriteIndex < MAX_SPRITES, "Tried getting sprite %u", spriteIndex);
|
||||
openrct2_assert(spriteIndex < MAX_ENTITIES, "Tried getting sprite %u", spriteIndex);
|
||||
return try_get_sprite(spriteIndex);
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void reset_sprite_list()
|
|||
{
|
||||
gSavedAge = 0;
|
||||
std::memset(static_cast<void*>(_spriteList), 0, sizeof(_spriteList));
|
||||
for (int32_t i = 0; i < MAX_SPRITES; ++i)
|
||||
for (int32_t i = 0; i < MAX_ENTITIES; ++i)
|
||||
{
|
||||
auto* spr = GetEntity(i);
|
||||
if (spr == nullptr)
|
||||
|
@ -290,7 +290,7 @@ void reset_sprite_spatial_index()
|
|||
{
|
||||
vec.clear();
|
||||
}
|
||||
for (size_t i = 0; i < MAX_SPRITES; i++)
|
||||
for (size_t i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
auto* spr = GetEntity(i);
|
||||
if (spr != nullptr && spr->sprite_identifier != SpriteIdentifier::Null)
|
||||
|
@ -320,7 +320,7 @@ rct_sprite_checksum sprite_checksum()
|
|||
}
|
||||
|
||||
_spriteHashAlg->Clear();
|
||||
for (size_t i = 0; i < MAX_SPRITES; i++)
|
||||
for (size_t i = 0; i < MAX_ENTITIES; i++)
|
||||
{
|
||||
// TODO create a way to copy only the specific type
|
||||
auto sprite = GetEntity(i);
|
||||
|
@ -945,12 +945,12 @@ EntityTweener& EntityTweener::Get()
|
|||
|
||||
void sprite_set_flashing(SpriteBase* sprite, bool flashing)
|
||||
{
|
||||
assert(sprite->sprite_index < MAX_SPRITES);
|
||||
assert(sprite->sprite_index < MAX_ENTITIES);
|
||||
_spriteFlashingList[sprite->sprite_index] = flashing;
|
||||
}
|
||||
|
||||
bool sprite_get_flashing(SpriteBase* sprite)
|
||||
{
|
||||
assert(sprite->sprite_index < MAX_SPRITES);
|
||||
assert(sprite->sprite_index < MAX_ENTITIES);
|
||||
return _spriteFlashingList[sprite->sprite_index];
|
||||
}
|
||||
|
|
|
@ -13,14 +13,10 @@
|
|||
#include "../common.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../ride/Vehicle.h"
|
||||
#include "Entity.h"
|
||||
#include "Fountain.h"
|
||||
#include "SpriteBase.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
#define SPRITE_INDEX_NULL 0xFFFF
|
||||
#define MAX_SPRITES 10000
|
||||
|
||||
enum class SpriteIdentifier : uint8_t
|
||||
{
|
||||
Vehicle = 0,
|
||||
|
@ -30,17 +26,6 @@ enum class SpriteIdentifier : uint8_t
|
|||
Null = 255
|
||||
};
|
||||
|
||||
enum class EntityListId : uint8_t
|
||||
{
|
||||
Free,
|
||||
TrainHead,
|
||||
Peep,
|
||||
Misc,
|
||||
Litter,
|
||||
Vehicle,
|
||||
Count,
|
||||
};
|
||||
|
||||
enum LitterType : uint8_t;
|
||||
|
||||
struct Litter : SpriteBase
|
||||
|
@ -213,23 +198,6 @@ enum LitterType : uint8_t
|
|||
LITTER_TYPE_EMPTY_BOWL_BLUE,
|
||||
};
|
||||
|
||||
SpriteBase* try_get_sprite(size_t spriteIndex);
|
||||
SpriteBase* get_sprite(size_t sprite_idx);
|
||||
template<typename T = SpriteBase> T* GetEntity(size_t sprite_idx)
|
||||
{
|
||||
auto spr = get_sprite(sprite_idx);
|
||||
return spr != nullptr ? spr->As<T>() : nullptr;
|
||||
}
|
||||
|
||||
template<typename T = SpriteBase> T* TryGetEntity(size_t sprite_idx)
|
||||
{
|
||||
auto spr = try_get_sprite(sprite_idx);
|
||||
return spr != nullptr ? spr->As<T>() : nullptr;
|
||||
}
|
||||
|
||||
uint16_t GetEntityListCount(EntityListId list);
|
||||
uint16_t GetNumFreeEntities();
|
||||
|
||||
constexpr const uint32_t SPATIAL_INDEX_SIZE = (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) + 1;
|
||||
constexpr const uint32_t SPATIAL_INDEX_LOCATION_NULL = SPATIAL_INDEX_SIZE - 1;
|
||||
|
||||
|
@ -237,7 +205,6 @@ extern const rct_string_id litterNames[12];
|
|||
|
||||
rct_sprite* create_sprite(SpriteIdentifier spriteIdentifier);
|
||||
rct_sprite* create_sprite(SpriteIdentifier spriteIdentifier, EntityListId linkedListIndex);
|
||||
void RebuildEntityLists();
|
||||
void reset_sprite_list();
|
||||
void reset_sprite_spatial_index();
|
||||
void sprite_clear_all_unused();
|
||||
|
@ -249,7 +216,6 @@ void litter_remove_at(const CoordsXYZ& litterPos);
|
|||
uint16_t remove_floating_sprites();
|
||||
void sprite_misc_explosion_cloud_create(const CoordsXYZ& cloudPos);
|
||||
void sprite_misc_explosion_flare_create(const CoordsXYZ& flarePos);
|
||||
const std::vector<uint16_t>& GetEntityTileList(const CoordsXY& spritePos);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Balloon
|
||||
|
@ -275,209 +241,6 @@ rct_sprite_checksum sprite_checksum();
|
|||
void sprite_set_flashing(SpriteBase* sprite, bool flashing);
|
||||
bool sprite_get_flashing(SpriteBase* sprite);
|
||||
|
||||
const std::list<uint16_t>& GetEntityList(const EntityListId id);
|
||||
|
||||
template<typename T, uint16_t SpriteBase::*NextList> class EntityIterator
|
||||
{
|
||||
private:
|
||||
T* Entity = nullptr;
|
||||
uint16_t NextEntityId = SPRITE_INDEX_NULL;
|
||||
|
||||
public:
|
||||
EntityIterator(const uint16_t _EntityId)
|
||||
: NextEntityId(_EntityId)
|
||||
{
|
||||
++(*this);
|
||||
}
|
||||
EntityIterator& operator++()
|
||||
{
|
||||
Entity = nullptr;
|
||||
|
||||
while (NextEntityId != SPRITE_INDEX_NULL && Entity == nullptr)
|
||||
{
|
||||
auto baseEntity = GetEntity(NextEntityId);
|
||||
if (!baseEntity)
|
||||
{
|
||||
NextEntityId = SPRITE_INDEX_NULL;
|
||||
continue;
|
||||
}
|
||||
NextEntityId = baseEntity->*NextList;
|
||||
Entity = baseEntity->template As<T>();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
EntityIterator operator++(int)
|
||||
{
|
||||
EntityIterator retval = *this;
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
bool operator==(EntityIterator other) const
|
||||
{
|
||||
return Entity == other.Entity;
|
||||
}
|
||||
bool operator!=(EntityIterator other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
T* operator*()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
// iterator traits
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = T;
|
||||
using pointer = const T*;
|
||||
using reference = const T&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
};
|
||||
|
||||
template<typename T> class EntityTileIterator
|
||||
{
|
||||
private:
|
||||
std::vector<uint16_t>::const_iterator iter;
|
||||
std::vector<uint16_t>::const_iterator end;
|
||||
T* Entity = nullptr;
|
||||
|
||||
public:
|
||||
EntityTileIterator(std::vector<uint16_t>::const_iterator _iter, std::vector<uint16_t>::const_iterator _end)
|
||||
: iter(_iter)
|
||||
, end(_end)
|
||||
{
|
||||
++(*this);
|
||||
}
|
||||
EntityTileIterator& operator++()
|
||||
{
|
||||
Entity = nullptr;
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = GetEntity<T>(*iter++);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
EntityTileIterator operator++(int)
|
||||
{
|
||||
EntityTileIterator retval = *this;
|
||||
++(*this);
|
||||
return *iter;
|
||||
}
|
||||
bool operator==(EntityTileIterator other) const
|
||||
{
|
||||
return Entity == other.Entity;
|
||||
}
|
||||
bool operator!=(EntityTileIterator other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
T* operator*()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
// iterator traits
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = T;
|
||||
using pointer = const T*;
|
||||
using reference = const T&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
};
|
||||
|
||||
template<typename T = SpriteBase> class EntityTileList
|
||||
{
|
||||
private:
|
||||
const std::vector<uint16_t>& vec;
|
||||
|
||||
public:
|
||||
EntityTileList(const CoordsXY& loc)
|
||||
: vec(GetEntityTileList(loc))
|
||||
{
|
||||
}
|
||||
|
||||
EntityTileIterator<T> begin()
|
||||
{
|
||||
return EntityTileIterator<T>(std::begin(vec), std::end(vec));
|
||||
}
|
||||
EntityTileIterator<T> end()
|
||||
{
|
||||
return EntityTileIterator<T>(std::end(vec), std::end(vec));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> class EntityListIterator
|
||||
{
|
||||
private:
|
||||
std::list<uint16_t>::const_iterator iter;
|
||||
std::list<uint16_t>::const_iterator end;
|
||||
T* Entity = nullptr;
|
||||
|
||||
public:
|
||||
EntityListIterator(std::list<uint16_t>::const_iterator _iter, std::list<uint16_t>::const_iterator _end)
|
||||
: iter(_iter)
|
||||
, end(_end)
|
||||
{
|
||||
++(*this);
|
||||
}
|
||||
EntityListIterator& operator++()
|
||||
{
|
||||
Entity = nullptr;
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = GetEntity<T>(*iter++);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
EntityListIterator operator++(int)
|
||||
{
|
||||
EntityListIterator retval = *this;
|
||||
++(*this);
|
||||
return *iter;
|
||||
}
|
||||
bool operator==(EntityListIterator other) const
|
||||
{
|
||||
return Entity == other.Entity;
|
||||
}
|
||||
bool operator!=(EntityListIterator other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
T* operator*()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
// iterator traits
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = T;
|
||||
using pointer = const T*;
|
||||
using reference = const T&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
};
|
||||
|
||||
template<typename T = SpriteBase> class EntityList
|
||||
{
|
||||
private:
|
||||
using EntityListIterator_t = EntityListIterator<T>;
|
||||
const std::list<uint16_t>& vec;
|
||||
|
||||
public:
|
||||
EntityList(EntityListId type)
|
||||
: vec(GetEntityList(type))
|
||||
{
|
||||
}
|
||||
|
||||
EntityListIterator_t begin()
|
||||
{
|
||||
return EntityListIterator_t(std::cbegin(vec), std::cend(vec));
|
||||
}
|
||||
EntityListIterator_t end()
|
||||
{
|
||||
return EntityListIterator_t(std::cend(vec), std::cend(vec));
|
||||
}
|
||||
};
|
||||
|
||||
class EntityTweener
|
||||
{
|
||||
std::vector<SpriteBase*> Entities;
|
||||
|
|
|
@ -170,7 +170,7 @@ template<> bool SpriteBase::Is<Vehicle>() const
|
|||
|
||||
SpriteBase* get_sprite(size_t sprite_idx)
|
||||
{
|
||||
assert(sprite_idx < MAX_SPRITES);
|
||||
assert(sprite_idx < MAX_ENTITIES);
|
||||
return reinterpret_cast<SpriteBase*>(&sprite_list[sprite_idx]);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace OpenRCT2;
|
|||
|
||||
struct GameState_t
|
||||
{
|
||||
rct_sprite sprites[MAX_SPRITES];
|
||||
rct_sprite sprites[MAX_ENTITIES];
|
||||
};
|
||||
|
||||
static bool LoadFileToBuffer(MemoryStream& stream, const std::string& filePath)
|
||||
|
@ -106,7 +106,7 @@ static bool ExportSave(MemoryStream& stream, std::unique_ptr<IContext>& context)
|
|||
static std::unique_ptr<GameState_t> GetGameState(std::unique_ptr<IContext>& context)
|
||||
{
|
||||
std::unique_ptr<GameState_t> res = std::make_unique<GameState_t>();
|
||||
for (size_t spriteIdx = 0; spriteIdx < MAX_SPRITES; spriteIdx++)
|
||||
for (size_t spriteIdx = 0; spriteIdx < MAX_ENTITIES; spriteIdx++)
|
||||
{
|
||||
rct_sprite* sprite = reinterpret_cast<rct_sprite*>(GetEntity(spriteIdx));
|
||||
if (sprite == nullptr)
|
||||
|
@ -461,7 +461,7 @@ static void CompareStates(
|
|||
static_cast<unsigned long long>(exportBuffer.GetLength()));
|
||||
}
|
||||
|
||||
for (size_t spriteIdx = 0; spriteIdx < MAX_SPRITES; ++spriteIdx)
|
||||
for (size_t spriteIdx = 0; spriteIdx < MAX_ENTITIES; ++spriteIdx)
|
||||
{
|
||||
if (importedState->sprites[spriteIdx].misc.sprite_identifier == SpriteIdentifier::Null
|
||||
&& exportedState->sprites[spriteIdx].misc.sprite_identifier == SpriteIdentifier::Null)
|
||||
|
|
Loading…
Reference in New Issue