Merge pull request #15282 from ZehMatt/refactor/entities

Rename SpriteBase to EntityBase
This commit is contained in:
ζeh Matt 2021-08-26 05:54:53 -07:00 committed by GitHub
commit 7e1ae9659f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 96 additions and 96 deletions

View File

@ -222,13 +222,13 @@ struct GameStateSnapshots final : public IGameStateSnapshots
}
void CompareSpriteDataCommon(
const SpriteBase& spriteBase, const SpriteBase& spriteCmp, GameStateSpriteChange_t& changeData) const
const EntityBase& spriteBase, const EntityBase& spriteCmp, GameStateSpriteChange_t& changeData) const
{
COMPARE_FIELD(SpriteBase, Type);
COMPARE_FIELD(SpriteBase, sprite_index);
COMPARE_FIELD(SpriteBase, x);
COMPARE_FIELD(SpriteBase, y);
COMPARE_FIELD(SpriteBase, z);
COMPARE_FIELD(EntityBase, Type);
COMPARE_FIELD(EntityBase, sprite_index);
COMPARE_FIELD(EntityBase, x);
COMPARE_FIELD(EntityBase, y);
COMPARE_FIELD(EntityBase, z);
/* Only relevant for rendering, does not affect game state.
COMPARE_FIELD(SpriteBase, sprite_width);
COMPARE_FIELD(SpriteBase, sprite_height_negative);
@ -238,7 +238,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(SpriteBase, sprite_right);
COMPARE_FIELD(SpriteBase, sprite_bottom);
*/
COMPARE_FIELD(SpriteBase, sprite_direction);
COMPARE_FIELD(EntityBase, sprite_direction);
}
void CompareSpriteDataPeep(const Peep& spriteBase, const Peep& spriteCmp, GameStateSpriteChange_t& changeData) const

View File

@ -684,7 +684,7 @@ static void LightfxAdd3DLight(const CoordsXYZ& loc, const LightType lightType)
LightfxAdd3DLight(((loc.x << 16) | loc.y), LightFXQualifier::Map, loc.z, loc, lightType);
}
void LightfxAdd3DLight(const SpriteBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType)
void LightfxAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType)
{
LightfxAdd3DLight(entity.sprite_index, LightFXQualifier::Entity, id, loc, lightType);
}

View File

@ -18,7 +18,7 @@ struct Vehicle;
struct rct_drawpixelinfo;
struct GamePalette;
struct CoordsXYZ;
struct SpriteBase;
struct EntityBase;
enum class LightType : uint8_t
{
@ -60,7 +60,7 @@ void lightfx_update_viewport_settings();
void* lightfx_get_front_buffer();
const GamePalette& lightfx_get_palette();
void LightfxAdd3DLight(const SpriteBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType);
void LightfxAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType);
void lightfx_add_3d_light_magic_from_drawing_tile(
const CoordsXY& mapPosition, int16_t offsetX, int16_t offsetY, int16_t offsetZ, LightType lightType);

View File

@ -24,7 +24,7 @@ struct Peep;
struct TileElement;
struct rct_window;
union paint_entry;
struct SpriteBase;
struct EntityBase;
enum
{
@ -77,7 +77,7 @@ struct InteractionInfo
union
{
TileElement* Element = nullptr;
SpriteBase* Entity;
EntityBase* Entity;
};
ViewportInteractionItem SpriteType = ViewportInteractionItem::None;
};

View File

@ -474,7 +474,7 @@
<ClInclude Include="world\ScenerySelection.h" />
<ClInclude Include="world\SmallScenery.h" />
<ClInclude Include="world\Sprite.h" />
<ClInclude Include="world\SpriteBase.h" />
<ClInclude Include="world\EntityBase.h" />
<ClInclude Include="world\Surface.h" />
<ClInclude Include="world\TileElement.h" />
<ClInclude Include="world\TileElementsView.h" />

View File

@ -429,7 +429,7 @@ static void peep_head_for_nearest_ride_type(Guest* peep, int32_t rideType);
static void peep_head_for_nearest_ride_with_flags(Guest* peep, int32_t rideTypeFlags);
bool loc_690FD0(Peep* peep, ride_id_t* rideToView, uint8_t* rideSeatToView, TileElement* tileElement);
template<> bool SpriteBase::Is<Guest>() const
template<> bool EntityBase::Is<Guest>() const
{
return Type == EntityType::Guest;
}

View File

@ -127,7 +127,7 @@ const bool gSpriteTypeToSlowWalkMap[] = {
// clang-format on
template<> bool SpriteBase::Is<Peep>() const
template<> bool EntityBase::Is<Peep>() const
{
return Type == EntityType::Guest || Type == EntityType::Staff;
}

View File

@ -16,8 +16,8 @@
#include "../ride/RideTypes.h"
#include "../ride/ShopItem.h"
#include "../util/Util.h"
#include "../world/EntityBase.h"
#include "../world/Location.hpp"
#include "../world/SpriteBase.h"
#include <algorithm>
#include <bitset>
@ -548,7 +548,7 @@ public:
}
};
struct Peep : SpriteBase
struct Peep : EntityBase
{
char* Name;
CoordsXYZ NextLoc;

View File

@ -73,7 +73,7 @@ colour_t gStaffSecurityColour;
// Maximum manhattan distance that litter can be for a handyman to seek to it
const uint16_t MAX_LITTER_DISTANCE = 3 * COORDS_XY_STEP;
template<> bool SpriteBase::Is<Staff>() const
template<> bool EntityBase::Is<Staff>() const
{
return Type == EntityType::Staff;
}

View File

@ -1294,7 +1294,7 @@ namespace RCT1
}
}
void ImportEntityCommonProperties(SpriteBase* dst, const RCT12SpriteBase* src)
void ImportEntityCommonProperties(EntityBase* dst, const RCT12SpriteBase* src)
{
dst->sprite_direction = src->sprite_direction;
dst->sprite_width = src->sprite_width;

View File

@ -1014,7 +1014,7 @@ void S6Exporter::RebuildEntityLinks()
}
}
constexpr RCT12EntityLinkListOffset GetRCT2LinkListOffset(const SpriteBase* src)
constexpr RCT12EntityLinkListOffset GetRCT2LinkListOffset(const EntityBase* src)
{
RCT12EntityLinkListOffset output = RCT12EntityLinkListOffset::Free;
switch (src->Type)
@ -1056,7 +1056,7 @@ constexpr RCT12EntityLinkListOffset GetRCT2LinkListOffset(const SpriteBase* src)
return output;
}
constexpr RCT12SpriteIdentifier GetRCT2SpriteIdentifier(const SpriteBase* src)
constexpr RCT12SpriteIdentifier GetRCT2SpriteIdentifier(const EntityBase* src)
{
RCT12SpriteIdentifier output = RCT12SpriteIdentifier::Null;
switch (src->Type)
@ -1088,7 +1088,7 @@ constexpr RCT12SpriteIdentifier GetRCT2SpriteIdentifier(const SpriteBase* src)
return output;
}
void S6Exporter::ExportEntityCommonProperties(RCT12SpriteBase* dst, const SpriteBase* src)
void S6Exporter::ExportEntityCommonProperties(RCT12SpriteBase* dst, const EntityBase* src)
{
dst->sprite_identifier = GetRCT2SpriteIdentifier(src);
dst->linked_list_type_offset = GetRCT2LinkListOffset(src);

View File

@ -27,7 +27,7 @@ struct Litter;
struct ObjectRepositoryItem;
struct RCT12SpriteBase;
union rct_sprite;
struct SpriteBase;
struct EntityBase;
/**
* Class to export RollerCoaster Tycoon 2 scenarios (*.SC6) and saved games (*.SV6).
@ -50,7 +50,7 @@ public:
void ExportRide(rct2_ride* dst, const Ride* src);
void ExportEntities();
template<typename RCT12_T, typename OpenRCT2_T> void ExportEntity(RCT12_T* dst, const OpenRCT2_T* src);
void ExportEntityCommonProperties(RCT12SpriteBase* dst, const SpriteBase* src);
void ExportEntityCommonProperties(RCT12SpriteBase* dst, const EntityBase* src);
void ExportEntityPeep(RCT2SpritePeep* dst, const Peep* src);
private:

View File

@ -1395,7 +1395,7 @@ public:
return pos.x == 0xFF && pos.y == 0xFF && pos.z == 0xFF && pos.direction == INVALID_DIRECTION;
};
ImportEntityCommonProperties(static_cast<SpriteBase*>(dst), src);
ImportEntityCommonProperties(static_cast<EntityBase*>(dst), src);
if (is_user_string_id(src->name_string_idx))
{
dst->SetName(GetUserString(src->name_string_idx));
@ -1520,7 +1520,7 @@ public:
return output;
}
void ImportEntityCommonProperties(SpriteBase* dst, const RCT12SpriteBase* src)
void ImportEntityCommonProperties(EntityBase* dst, const RCT12SpriteBase* src)
{
dst->Type = GetEntityTypeFromRCT2Sprite(src);
dst->sprite_height_negative = src->sprite_height_negative;

View File

@ -735,7 +735,7 @@ static const struct
// clang-format on
template<> bool SpriteBase::Is<Vehicle>() const
template<> bool EntityBase::Is<Vehicle>() const
{
return Type == EntityType::Vehicle;
}

View File

@ -12,8 +12,8 @@
#include "../audio/audio.h"
#include "../common.h"
#include "../ride/RideTypes.h"
#include "../world/EntityBase.h"
#include "../world/Location.hpp"
#include "../world/SpriteBase.h"
#include "Station.h"
#include "VehicleColour.h"
#include "VehicleEntry.h"
@ -53,7 +53,7 @@ constexpr const uint16_t VehicleTrackTypeMask = 0b1111111111111100;
enum class MiniGolfAnimation : uint8_t;
struct Vehicle : SpriteBase
struct Vehicle : EntityBase
{
static constexpr auto cEntityType = EntityType::Vehicle;

View File

@ -190,7 +190,7 @@ namespace OpenRCT2::Scripting
}
}
SpriteBase* GetEntity() const
EntityBase* GetEntity() const
{
return ::GetEntity(_id);
}

View File

@ -253,7 +253,7 @@ namespace OpenRCT2::Scripting
dukglue_register_method(ctx, &ScMap::createEntity, "createEntity");
}
DukValue ScMap::GetEntityAsDukValue(const SpriteBase* sprite) const
DukValue ScMap::GetEntityAsDukValue(const EntityBase* sprite) const
{
auto spriteId = sprite->sprite_index;
switch (sprite->Type)

View File

@ -47,7 +47,7 @@ namespace OpenRCT2::Scripting
static void Register(duk_context* ctx);
private:
DukValue GetEntityAsDukValue(const SpriteBase* sprite) const;
DukValue GetEntityAsDukValue(const EntityBase* sprite) const;
};
} // namespace OpenRCT2::Scripting

View File

@ -16,7 +16,7 @@
#include "../util/Util.h"
#include "Sprite.h"
template<> bool SpriteBase::Is<Balloon>() const
template<> bool EntityBase::Is<Balloon>() const
{
return Type == EntityType::Balloon;
}

View File

@ -9,7 +9,7 @@
#pragma once
#include "SpriteBase.h"
#include "EntityBase.h"
class DataSerialiser;
struct CoordsXYZ;

View File

@ -67,7 +67,7 @@ static constexpr const uint8_t * DuckAnimations[] =
};
// clang-format on
template<> bool SpriteBase::Is<Duck>() const
template<> bool EntityBase::Is<Duck>() const
{
return Type == EntityType::Duck;
}

View File

@ -9,7 +9,7 @@
#pragma once
#include "SpriteBase.h"
#include "EntityBase.h"
class DataSerialiser;
struct CoordsXY;

View File

@ -18,7 +18,7 @@
#include "MoneyEffect.h"
#include "Particle.h"
static void EntityBaseSerialise(SpriteBase& base, DataSerialiser& stream)
static void EntityBaseSerialise(EntityBase& base, DataSerialiser& stream)
{
stream << base.Type;
stream << base.sprite_index;

View File

@ -9,33 +9,33 @@
#pragma once
#include "SpriteBase.h"
#include "EntityBase.h"
constexpr uint16_t MAX_ENTITIES = 10000;
SpriteBase* try_get_sprite(size_t spriteIndex);
SpriteBase* get_sprite(size_t sprite_idx);
EntityBase* try_get_sprite(size_t spriteIndex);
EntityBase* get_sprite(size_t sprite_idx);
template<typename T = SpriteBase> T* GetEntity(size_t sprite_idx)
template<typename T = EntityBase> 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)
template<typename T = EntityBase> T* TryGetEntity(size_t sprite_idx)
{
auto spr = try_get_sprite(sprite_idx);
return spr != nullptr ? spr->As<T>() : nullptr;
}
SpriteBase* CreateEntity(EntityType type);
EntityBase* 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);
EntityBase* 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)
{

View File

@ -23,7 +23,7 @@ enum class EntityType : uint8_t
Null = 255
};
struct SpriteBase
struct EntityBase
{
EntityType Type;
uint16_t sprite_index;
@ -74,7 +74,7 @@ struct SpriteBase
}
};
struct MiscEntity : SpriteBase
struct MiscEntity : EntityBase
{
uint16_t frame;
};

View File

@ -12,8 +12,8 @@
#include "../common.h"
#include "../rct12/RCT12.h"
#include "Entity.h"
#include "EntityBase.h"
#include "Location.hpp"
#include "SpriteBase.h"
#include <list>
#include <vector>
@ -81,7 +81,7 @@ public:
using iterator_category = std::forward_iterator_tag;
};
template<typename T = SpriteBase> class EntityTileList
template<typename T = EntityBase> class EntityTileList
{
private:
const std::vector<uint16_t>& vec;
@ -153,7 +153,7 @@ public:
using iterator_category = std::forward_iterator_tag;
};
template<typename T = SpriteBase> class EntityList
template<typename T = EntityBase> class EntityList
{
private:
using EntityListIterator_t = EntityListIterator<T>;

View File

@ -57,7 +57,7 @@ void EntityTweener::PostTick()
}
}
void EntityTweener::RemoveEntity(SpriteBase* entity)
void EntityTweener::RemoveEntity(EntityBase* entity)
{
if (!entity->Is<Peep>() && !entity->Is<Vehicle>())
{

View File

@ -9,13 +9,13 @@
#pragma once
#include "SpriteBase.h"
#include "EntityBase.h"
#include <vector>
class EntityTweener
{
std::vector<SpriteBase*> Entities;
std::vector<EntityBase*> Entities;
std::vector<CoordsXYZ> PrePos;
std::vector<CoordsXYZ> PostPos;
@ -27,7 +27,7 @@ public:
void PreTick();
void PostTick();
void RemoveEntity(SpriteBase* entity);
void RemoveEntity(EntityBase* entity);
void Tween(float alpha);
void Restore();
void Reset();

View File

@ -70,7 +70,7 @@ const uint8_t _fountainPatternFlags[] = {
FOUNTAIN_FLAG::FAST // FAST_RANDOM_CHASERS
};
template<> bool SpriteBase::Is<JumpingFountain>() const
template<> bool EntityBase::Is<JumpingFountain>() const
{
return Type == EntityType::JumpingFountain;
}

View File

@ -10,8 +10,8 @@
#pragma once
#include "../common.h"
#include "EntityBase.h"
#include "Map.h"
#include "SpriteBase.h"
class DataSerialiser;

View File

@ -9,13 +9,13 @@
#pragma once
#include "SpriteBase.h"
#include "EntityBase.h"
class DataSerialiser;
struct CoordsXYZ;
struct CoordsXYZD;
struct Litter : SpriteBase
struct Litter : EntityBase
{
enum class Type : uint8_t
{

View File

@ -20,7 +20,7 @@
static constexpr const CoordsXY _moneyEffectMoveOffset[] = { { 1, -1 }, { 1, 1 }, { -1, 1 }, { -1, -1 } };
template<> bool SpriteBase::Is<MoneyEffect>() const
template<> bool EntityBase::Is<MoneyEffect>() const
{
return Type == EntityType::MoneyEffect;
}

View File

@ -9,7 +9,7 @@
#pragma once
#include "SpriteBase.h"
#include "EntityBase.h"
class DataSerialiser;
struct CoordsXYZ;

View File

@ -15,12 +15,12 @@
#include <iterator>
template<> bool SpriteBase::Is<VehicleCrashParticle>() const
template<> bool EntityBase::Is<VehicleCrashParticle>() const
{
return Type == EntityType::CrashedVehicleParticle;
}
template<> bool SpriteBase::Is<CrashSplashParticle>() const
template<> bool EntityBase::Is<CrashSplashParticle>() const
{
return Type == EntityType::CrashSplash;
}

View File

@ -10,7 +10,7 @@
#pragma once
#include "../ride/VehicleColour.h"
#include "SpriteBase.h"
#include "EntityBase.h"
class DataSerialiser;
struct CoordsXYZ;

View File

@ -44,7 +44,7 @@ constexpr const uint32_t SPATIAL_INDEX_LOCATION_NULL = SPATIAL_INDEX_SIZE - 1;
static std::array<std::vector<uint16_t>, SPATIAL_INDEX_SIZE> gSpriteSpatialIndex;
static void FreeEntity(SpriteBase* entity);
static void FreeEntity(EntityBase* entity);
constexpr size_t GetSpatialIndexOffset(int32_t x, int32_t y)
{
@ -67,12 +67,12 @@ constexpr size_t GetSpatialIndexOffset(int32_t x, int32_t y)
}
// Required for GetEntity to return a default
template<> bool SpriteBase::Is<SpriteBase>() const
template<> bool EntityBase::Is<EntityBase>() const
{
return true;
}
template<> bool SpriteBase::Is<Litter>() const
template<> bool EntityBase::Is<Litter>() const
{
return Type == EntityType::Litter;
}
@ -96,22 +96,22 @@ constexpr bool EntityTypeIsMiscEntity(const EntityType type)
}
}
template<> bool SpriteBase::Is<MiscEntity>() const
template<> bool EntityBase::Is<MiscEntity>() const
{
return EntityTypeIsMiscEntity(Type);
}
template<> bool SpriteBase::Is<SteamParticle>() const
template<> bool EntityBase::Is<SteamParticle>() const
{
return Type == EntityType::SteamParticle;
}
template<> bool SpriteBase::Is<ExplosionFlare>() const
template<> bool EntityBase::Is<ExplosionFlare>() const
{
return Type == EntityType::ExplosionFlare;
}
template<> bool SpriteBase::Is<ExplosionCloud>() const
template<> bool EntityBase::Is<ExplosionCloud>() const
{
return Type == EntityType::ExplosionCloud;
}
@ -141,12 +141,12 @@ std::string rct_sprite_checksum::ToString() const
return result;
}
SpriteBase* try_get_sprite(size_t spriteIndex)
EntityBase* try_get_sprite(size_t spriteIndex)
{
return spriteIndex >= MAX_ENTITIES ? nullptr : &_spriteList[spriteIndex].base;
}
SpriteBase* get_sprite(size_t spriteIndex)
EntityBase* get_sprite(size_t spriteIndex)
{
if (spriteIndex == SPRITE_INDEX_NULL)
{
@ -161,7 +161,7 @@ const std::vector<uint16_t>& GetEntityTileList(const CoordsXY& spritePos)
return gSpriteSpatialIndex[GetSpatialIndexOffset(spritePos.x, spritePos.y)];
}
void SpriteBase::Invalidate()
void EntityBase::Invalidate()
{
if (sprite_left == LOCATION_NULL)
return;
@ -249,7 +249,7 @@ void reset_sprite_list()
reset_sprite_spatial_index();
}
static void SpriteSpatialInsert(SpriteBase* sprite, const CoordsXY& newLoc);
static void SpriteSpatialInsert(EntityBase* sprite, const CoordsXY& newLoc);
/**
*
@ -307,7 +307,7 @@ rct_sprite_checksum sprite_checksum()
#endif // DISABLE_NETWORK
static void sprite_reset(SpriteBase* sprite)
static void sprite_reset(EntityBase* sprite)
{
// Need to retain how the sprite is linked in lists
uint16_t sprite_index = sprite->sprite_index;
@ -320,7 +320,7 @@ static void sprite_reset(SpriteBase* sprite)
}
static constexpr uint16_t MAX_MISC_SPRITES = 300;
static void AddToEntityList(SpriteBase* entity)
static void AddToEntityList(EntityBase* entity)
{
auto& list = gEntityLists[EnumValue(entity->Type)];
// Entity list must be in sprite_index order to prevent desync issues
@ -333,7 +333,7 @@ static void AddToFreeList(uint16_t index)
_freeIdList.insert(std::upper_bound(std::rbegin(_freeIdList), std::rend(_freeIdList), index).base(), index);
}
static void RemoveFromEntityList(SpriteBase* entity)
static void RemoveFromEntityList(EntityBase* entity)
{
auto& list = gEntityLists[EnumValue(entity->Type)];
auto ptr = std::lower_bound(std::begin(list), std::end(list), entity->sprite_index);
@ -355,7 +355,7 @@ uint16_t GetMiscEntityCount()
return count;
}
static void PrepareNewEntity(SpriteBase* base, const EntityType type)
static void PrepareNewEntity(EntityBase* base, const EntityType type)
{
// Need to reset all sprite data, as the uninitialised values
// may contain garbage and cause a desync later on.
@ -375,7 +375,7 @@ static void PrepareNewEntity(SpriteBase* base, const EntityType type)
SpriteSpatialInsert(base, { LOCATION_NULL, 0 });
}
SpriteBase* CreateEntity(EntityType type)
EntityBase* CreateEntity(EntityType type)
{
if (_freeIdList.size() == 0)
{
@ -407,7 +407,7 @@ SpriteBase* CreateEntity(EntityType type)
return entity;
}
SpriteBase* CreateEntityAt(const uint16_t index, const EntityType type)
EntityBase* CreateEntityAt(const uint16_t index, const EntityType type)
{
auto id = std::lower_bound(std::rbegin(_freeIdList), std::rend(_freeIdList), index);
if (id == std::rend(_freeIdList) || *id != index)
@ -452,7 +452,7 @@ void sprite_misc_update_all()
}
// Performs a search to ensure that insert keeps next_in_quadrant in sprite_index order
static void SpriteSpatialInsert(SpriteBase* sprite, const CoordsXY& newLoc)
static void SpriteSpatialInsert(EntityBase* sprite, const CoordsXY& newLoc)
{
size_t newIndex = GetSpatialIndexOffset(newLoc.x, newLoc.y);
auto& spatialVector = gSpriteSpatialIndex[newIndex];
@ -460,7 +460,7 @@ static void SpriteSpatialInsert(SpriteBase* sprite, const CoordsXY& newLoc)
spatialVector.insert(index, sprite->sprite_index);
}
static void SpriteSpatialRemove(SpriteBase* sprite)
static void SpriteSpatialRemove(EntityBase* sprite)
{
size_t currentIndex = GetSpatialIndexOffset(sprite->x, sprite->y);
auto& spatialVector = gSpriteSpatialIndex[currentIndex];
@ -476,7 +476,7 @@ static void SpriteSpatialRemove(SpriteBase* sprite)
}
}
static void SpriteSpatialMove(SpriteBase* sprite, const CoordsXY& newLoc)
static void SpriteSpatialMove(EntityBase* sprite, const CoordsXY& newLoc)
{
size_t newIndex = GetSpatialIndexOffset(newLoc.x, newLoc.y);
size_t currentIndex = GetSpatialIndexOffset(sprite->x, sprite->y);
@ -487,7 +487,7 @@ static void SpriteSpatialMove(SpriteBase* sprite, const CoordsXY& newLoc)
SpriteSpatialInsert(sprite, newLoc);
}
void SpriteBase::MoveTo(const CoordsXYZ& newLocation)
void EntityBase::MoveTo(const CoordsXYZ& newLocation)
{
if (x != LOCATION_NULL)
{
@ -517,19 +517,19 @@ void SpriteBase::MoveTo(const CoordsXYZ& newLocation)
}
}
CoordsXYZ SpriteBase::GetLocation() const
CoordsXYZ EntityBase::GetLocation() const
{
return { x, y, z };
}
void SpriteBase::SetLocation(const CoordsXYZ& newLocation)
void EntityBase::SetLocation(const CoordsXYZ& newLocation)
{
x = static_cast<int16_t>(newLocation.x);
y = static_cast<int16_t>(newLocation.y);
z = static_cast<int16_t>(newLocation.z);
}
void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite)
void sprite_set_coordinates(const CoordsXYZ& spritePos, EntityBase* sprite)
{
auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), spritePos);
@ -545,7 +545,7 @@ void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite)
/**
* Frees any dynamically attached memory to the entity, such as peep name.
*/
static void FreeEntity(SpriteBase* entity)
static void FreeEntity(EntityBase* entity)
{
auto* guest = entity->As<Guest>();
auto* staff = entity->As<Staff>();
@ -565,7 +565,7 @@ static void FreeEntity(SpriteBase* entity)
*
* rct2: 0x0069EDB6
*/
void sprite_remove(SpriteBase* sprite)
void sprite_remove(EntityBase* sprite)
{
FreeEntity(sprite);
@ -605,13 +605,13 @@ uint16_t remove_floating_sprites()
return removed;
}
void sprite_set_flashing(SpriteBase* sprite, bool flashing)
void sprite_set_flashing(EntityBase* sprite, bool flashing)
{
assert(sprite->sprite_index < MAX_ENTITIES);
_spriteFlashingList[sprite->sprite_index] = flashing;
}
bool sprite_get_flashing(SpriteBase* sprite)
bool sprite_get_flashing(EntityBase* sprite)
{
assert(sprite->sprite_index < MAX_ENTITIES);
return _spriteFlashingList[sprite->sprite_index];

View File

@ -10,7 +10,7 @@
#pragma once
#include "../common.h"
#include "SpriteBase.h"
#include "EntityBase.h"
#include <array>
@ -22,7 +22,7 @@
union rct_sprite
{
uint8_t pad_00[0x200];
SpriteBase base;
EntityBase base;
};
assert_struct_size(rct_sprite, 0x200);
@ -38,11 +38,11 @@ struct rct_sprite_checksum
void reset_sprite_list();
void reset_sprite_spatial_index();
void sprite_misc_update_all();
void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite);
void sprite_remove(SpriteBase* sprite);
void sprite_set_coordinates(const CoordsXYZ& spritePos, EntityBase* sprite);
void sprite_remove(EntityBase* sprite);
uint16_t remove_floating_sprites();
rct_sprite_checksum sprite_checksum();
void sprite_set_flashing(SpriteBase* sprite, bool flashing);
bool sprite_get_flashing(SpriteBase* sprite);
void sprite_set_flashing(EntityBase* sprite, bool flashing);
bool sprite_get_flashing(EntityBase* sprite);