Files
OpenRCT2-Web/src/openrct2/entity/EntityRegistry.cpp
T

568 lines
14 KiB
C++
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
2014-05-25 19:47:11 +01:00
*
2018-06-15 14:07:34 +02:00
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2014-05-25 19:47:11 +01:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2014-05-25 19:47:11 +01:00
*****************************************************************************/
2021-11-24 16:58:01 +02:00
#include "EntityRegistry.h"
2018-06-22 23:17:03 +02:00
#include "../Game.h"
2022-03-08 19:49:43 +00:00
#include "../core/Algorithm.hpp"
2021-05-09 19:12:44 +01:00
#include "../core/ChecksumStream.h"
2018-05-23 20:27:00 +01:00
#include "../core/Crypt.h"
2021-05-09 19:12:44 +01:00
#include "../core/DataSerialiser.h"
2018-03-13 13:14:02 +01:00
#include "../core/Guard.hpp"
2021-05-09 19:12:44 +01:00
#include "../core/MemoryStream.h"
2021-11-25 23:47:24 +02:00
#include "../entity/Peep.h"
#include "../entity/Staff.h"
2018-01-05 23:45:53 +00:00
#include "../interface/Viewport.h"
#include "../peep/RideUseSystem.h"
2022-01-18 10:21:20 -08:00
#include "../profiling/Profiling.h"
2021-05-29 06:01:32 +01:00
#include "../ride/Vehicle.h"
2018-01-02 17:58:43 +00:00
#include "../scenario/Scenario.h"
2021-05-29 06:01:32 +01:00
#include "Balloon.h"
#include "Duck.h"
2021-05-29 07:47:49 +01:00
#include "EntityTweener.h"
2017-03-23 17:56:39 +00:00
#include "Fountain.h"
2021-05-29 06:01:32 +01:00
#include "MoneyEffect.h"
#include "Particle.h"
2018-06-22 23:17:03 +02:00
#include <algorithm>
#include <cmath>
2018-11-21 23:16:04 +01:00
#include <iterator>
#include <numeric>
2021-01-23 07:36:46 +00:00
#include <vector>
2014-05-25 19:47:11 +01:00
2021-11-24 15:58:16 +02:00
union Entity
{
2023-01-21 16:39:35 +01:00
uint8_t Pad00[0x200];
EntityBase base;
Entity()
2023-01-21 16:39:35 +01:00
: Pad00()
{
}
2021-11-24 15:58:16 +02:00
};
2021-11-24 16:22:29 +02:00
static Entity _entities[MAX_ENTITIES]{};
2022-02-12 23:31:06 +02:00
static std::array<std::list<EntityId>, EnumValue(EntityType::Count)> gEntityLists;
static std::vector<EntityId> _freeIdList;
2021-11-24 15:37:47 +02:00
static bool _entityFlashingList[MAX_ENTITIES];
2021-05-29 06:01:32 +01:00
constexpr const uint32_t SPATIAL_INDEX_SIZE = (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) + 1;
constexpr uint32_t SPATIAL_INDEX_LOCATION_NULL = SPATIAL_INDEX_SIZE - 1;
2021-05-29 06:01:32 +01:00
2022-02-12 23:31:06 +02:00
static std::array<std::vector<EntityId>, SPATIAL_INDEX_SIZE> gEntitySpatialIndex;
2016-05-09 00:08:03 +01:00
2021-09-12 18:29:37 +02:00
static void FreeEntity(EntityBase& entity);
2021-09-29 09:19:47 -07:00
static constexpr size_t GetSpatialIndexOffset(const CoordsXY& loc)
2021-01-23 07:36:46 +00:00
{
2021-09-29 09:19:47 -07:00
if (loc.IsNull())
return SPATIAL_INDEX_LOCATION_NULL;
2021-01-23 07:36:46 +00:00
2021-09-29 09:19:47 -07:00
// NOTE: The input coordinate is rotated and can have negative components.
const auto tileX = std::abs(loc.x) / COORDS_XY_STEP;
const auto tileY = std::abs(loc.y) / COORDS_XY_STEP;
2021-01-23 07:36:46 +00:00
2021-09-29 09:19:47 -07:00
if (tileX >= MAXIMUM_MAP_SIZE_TECHNICAL || tileY >= MAXIMUM_MAP_SIZE_TECHNICAL)
2021-01-23 07:36:46 +00:00
return SPATIAL_INDEX_LOCATION_NULL;
2021-09-29 09:19:47 -07:00
return tileX * MAXIMUM_MAP_SIZE_TECHNICAL + tileY;
2021-01-23 07:36:46 +00:00
}
constexpr bool EntityTypeIsMiscEntity(const EntityType type)
2021-01-10 15:14:34 +00:00
{
switch (type)
{
case EntityType::SteamParticle:
case EntityType::MoneyEffect:
case EntityType::CrashedVehicleParticle:
case EntityType::ExplosionCloud:
case EntityType::CrashSplash:
case EntityType::ExplosionFlare:
case EntityType::JumpingFountain:
case EntityType::Balloon:
case EntityType::Duck:
return true;
default:
return false;
}
2021-01-10 15:14:34 +00:00
}
2021-03-16 11:18:06 +00:00
uint16_t GetEntityListCount(EntityType type)
{
2021-03-16 11:18:06 +00:00
return static_cast<uint16_t>(gEntityLists[EnumValue(type)].size());
}
uint16_t GetNumFreeEntities()
{
return static_cast<uint16_t>(_freeIdList.size());
}
2021-11-24 15:37:47 +02:00
std::string EntitiesChecksum::ToString() const
{
std::string result;
result.reserve(raw.size() * 2);
for (auto b : raw)
{
char buf[3];
2021-05-09 19:12:44 +01:00
snprintf(buf, 3, "%02x", static_cast<int32_t>(b));
result.append(buf);
}
return result;
}
2022-02-12 23:31:06 +02:00
EntityBase* TryGetEntity(EntityId entityIndex)
2017-03-10 17:26:08 +00:00
{
2022-02-12 23:31:06 +02:00
const auto idx = entityIndex.ToUnderlying();
return idx >= MAX_ENTITIES ? nullptr : &_entities[idx].base;
2017-03-10 17:26:08 +00:00
}
2022-02-12 23:31:06 +02:00
EntityBase* GetEntity(EntityId entityIndex)
2016-07-17 22:14:44 +02:00
{
2022-02-12 23:31:06 +02:00
if (entityIndex.IsNull())
{
return nullptr;
}
Guard::Assert(entityIndex.ToUnderlying() < MAX_ENTITIES, "Tried getting entity %u", entityIndex.ToUnderlying());
2021-11-24 15:37:47 +02:00
return TryGetEntity(entityIndex);
2016-07-17 22:14:44 +02:00
}
2022-02-12 23:31:06 +02:00
const std::vector<EntityId>& GetEntityTileList(const CoordsXY& spritePos)
2015-09-05 13:59:12 +01:00
{
2021-11-24 15:27:48 +02:00
return gEntitySpatialIndex[GetSpatialIndexOffset(spritePos)];
2015-09-05 13:59:12 +01:00
}
static void ResetEntityLists()
2021-01-21 18:36:34 +00:00
{
for (auto& list : gEntityLists)
{
list.clear();
}
}
2021-01-21 18:36:34 +00:00
static void ResetFreeIds()
{
_freeIdList.clear();
_freeIdList.resize(MAX_ENTITIES);
2022-02-12 23:31:06 +02:00
// List needs to be back to front to simplify removing
2022-02-12 23:31:06 +02:00
auto nextId = 0;
std::for_each(std::rbegin(_freeIdList), std::rend(_freeIdList), [&](auto& elem) {
elem = EntityId::FromUnderlying(nextId);
nextId++;
});
2021-01-21 18:36:34 +00:00
}
2022-02-12 23:31:06 +02:00
const std::list<EntityId>& GetEntityList(const EntityType id)
2021-01-21 18:36:34 +00:00
{
return gEntityLists[EnumValue(id)];
}
2015-03-25 23:57:09 +00:00
2015-12-11 09:38:37 -06:00
/**
*
2015-12-11 09:38:37 -06:00
* rct2: 0x0069EB13
*/
2021-11-24 15:27:48 +02:00
void ResetAllEntities()
2016-05-09 00:08:03 +01:00
{
// Free all associated Entity pointers prior to zeroing memory
for (int32_t i = 0; i < MAX_ENTITIES; ++i)
{
2022-02-12 23:31:06 +02:00
auto* spr = GetEntity(EntityId::FromUnderlying(i));
if (spr == nullptr)
{
continue;
}
FreeEntity(*spr);
}
2021-11-24 15:37:47 +02:00
std::fill(std::begin(_entities), std::end(_entities), Entity());
OpenRCT2::RideUse::GetHistory().Clear();
OpenRCT2::RideUse::GetTypeHistory().Clear();
for (int32_t i = 0; i < MAX_ENTITIES; ++i)
2018-06-22 23:17:03 +02:00
{
2022-02-12 23:31:06 +02:00
auto* spr = GetEntity(EntityId::FromUnderlying(i));
2020-07-06 22:02:25 +01:00
if (spr == nullptr)
{
continue;
}
spr->Type = EntityType::Null;
2023-01-27 19:18:44 +02:00
spr->Id = EntityId::FromUnderlying(i);
2021-11-24 15:37:47 +02:00
_entityFlashingList[i] = false;
2017-06-06 23:24:18 +02:00
}
ResetEntityLists();
ResetFreeIds();
2021-11-24 15:37:47 +02:00
ResetEntitySpatialIndices();
2014-06-21 13:31:28 +01:00
}
2021-11-24 15:37:47 +02:00
static void EntitySpatialInsert(EntityBase* entity, const CoordsXY& newLoc);
2021-01-23 07:36:46 +00:00
/**
2015-12-11 09:38:37 -06:00
*
* rct2: 0x0069EBE4
2014-06-21 13:31:28 +01:00
* This function looks as though it sets some sort of order for sprites.
2017-04-29 23:39:24 -05:00
* Sprites can share their position if this is the case.
2014-06-21 13:31:28 +01:00
*/
2021-11-24 15:37:47 +02:00
void ResetEntitySpatialIndices()
2016-05-09 00:08:03 +01:00
{
2021-11-24 15:27:48 +02:00
for (auto& vec : gEntitySpatialIndex)
2021-01-23 07:36:46 +00:00
{
vec.clear();
}
for (EntityId::UnderlyingType i = 0; i < MAX_ENTITIES; i++)
2018-06-22 23:17:03 +02:00
{
2022-02-12 23:31:06 +02:00
auto* spr = GetEntity(EntityId::FromUnderlying(i));
if (spr != nullptr && spr->Type != EntityType::Null)
2018-06-22 23:17:03 +02:00
{
2021-11-24 15:37:47 +02:00
EntitySpatialInsert(spr, { spr->x, spr->y });
2017-06-06 23:24:18 +02:00
}
}
}
#ifndef DISABLE_NETWORK
2021-05-09 19:12:44 +01:00
template<typename T> void NetworkSerialseEntityType(DataSerialiser& ds)
2021-03-27 09:36:41 +00:00
{
for (auto* ent : EntityList<T>())
{
2021-05-09 19:12:44 +01:00
ent->Serialise(ds);
2021-03-27 09:36:41 +00:00
}
}
2021-05-09 19:12:44 +01:00
template<typename... T> void NetworkSerialiseEntityTypes(DataSerialiser& ds)
2021-03-27 09:36:41 +00:00
{
2021-05-09 19:12:44 +01:00
(NetworkSerialseEntityType<T>(ds), ...);
2021-03-27 09:36:41 +00:00
}
2021-11-24 15:37:47 +02:00
EntitiesChecksum GetAllEntitiesChecksum()
{
2021-11-24 15:37:47 +02:00
EntitiesChecksum checksum{};
2021-05-09 19:12:44 +01:00
OpenRCT2::ChecksumStream ms(checksum.raw);
DataSerialiser ds(true, ms);
NetworkSerialiseEntityTypes<Guest, Staff, Vehicle, Litter>(ds);
return checksum;
}
#else
2021-11-24 15:37:47 +02:00
EntitiesChecksum GetAllEntitiesChecksum()
{
2021-11-24 15:37:47 +02:00
return EntitiesChecksum{};
}
#endif // DISABLE_NETWORK
2021-11-24 15:37:47 +02:00
static void EntityReset(EntityBase* entity)
2016-07-23 13:32:58 +02:00
{
2017-06-06 23:24:18 +02:00
// Need to retain how the sprite is linked in lists
2023-01-27 19:18:44 +02:00
auto entityIndex = entity->Id;
2022-02-12 23:31:06 +02:00
_entityFlashingList[entityIndex.ToUnderlying()] = false;
2016-07-23 13:32:58 +02:00
2021-11-24 15:37:47 +02:00
Entity* spr = reinterpret_cast<Entity*>(entity);
*spr = Entity();
2016-07-23 13:32:58 +02:00
2023-01-27 19:18:44 +02:00
entity->Id = entityIndex;
2021-11-24 15:37:47 +02:00
entity->Type = EntityType::Null;
2016-07-23 13:32:58 +02:00
}
2024-01-19 12:40:14 +02:00
static constexpr uint16_t MAX_MISC_SPRITES = 1600;
2021-08-25 17:42:09 +03:00
static void AddToEntityList(EntityBase* entity)
2021-01-21 18:36:34 +00:00
{
auto& list = gEntityLists[EnumValue(entity->Type)];
2021-01-21 18:36:34 +00:00
// Entity list must be in sprite_index order to prevent desync issues
2023-01-27 19:18:44 +02:00
list.insert(std::lower_bound(std::begin(list), std::end(list), entity->Id), entity->Id);
2021-01-21 18:36:34 +00:00
}
2022-02-12 23:31:06 +02:00
static void AddToFreeList(EntityId index)
{
// Free list must be in reverse sprite_index order to prevent desync issues
_freeIdList.insert(std::upper_bound(std::rbegin(_freeIdList), std::rend(_freeIdList), index).base(), index);
}
2021-08-25 17:42:09 +03:00
static void RemoveFromEntityList(EntityBase* entity)
2021-01-21 18:36:34 +00:00
{
auto& list = gEntityLists[EnumValue(entity->Type)];
2023-01-27 19:18:44 +02:00
auto ptr = BinaryFind(std::begin(list), std::end(list), entity->Id);
2022-03-08 19:49:43 +00:00
if (ptr != std::end(list))
2021-01-21 18:36:34 +00:00
{
list.erase(ptr);
}
}
2021-03-16 11:18:06 +00:00
uint16_t GetMiscEntityCount()
{
uint16_t count = 0;
for (auto id : { EntityType::SteamParticle, EntityType::MoneyEffect, EntityType::CrashedVehicleParticle,
EntityType::ExplosionCloud, EntityType::CrashSplash, EntityType::ExplosionFlare,
EntityType::JumpingFountain, EntityType::Balloon, EntityType::Duck })
{
count += GetEntityListCount(id);
}
return count;
}
2021-08-25 17:42:09 +03:00
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.
2021-11-24 15:37:47 +02:00
EntityReset(base);
base->Type = type;
AddToEntityList(base);
base->x = LOCATION_NULL;
base->y = LOCATION_NULL;
base->z = 0;
2023-04-07 19:47:26 +03:00
base->SpriteData.Width = 0x10;
base->SpriteData.HeightMin = 0x14;
base->SpriteData.HeightMax = 0x8;
base->SpriteData.SpriteRect = {};
2021-11-24 15:37:47 +02:00
EntitySpatialInsert(base, { LOCATION_NULL, 0 });
}
2021-08-25 17:42:09 +03:00
EntityBase* CreateEntity(EntityType type)
{
if (_freeIdList.size() == 0)
2018-06-22 23:17:03 +02:00
{
// No free sprites.
return nullptr;
}
if (EntityTypeIsMiscEntity(type))
{
// Misc sprites are commonly used for effects, give other entity types higher priority.
if (GetMiscEntityCount() >= MAX_MISC_SPRITES)
{
return nullptr;
}
// If there are less than MAX_MISC_SPRITES free slots, ensure other entities can be created.
if (_freeIdList.size() < MAX_MISC_SPRITES)
2018-06-22 23:17:03 +02:00
{
2018-01-29 17:06:01 +01:00
return nullptr;
2017-06-06 23:24:18 +02:00
}
}
auto* entity = GetEntity(_freeIdList.back());
if (entity == nullptr)
2020-07-06 22:02:25 +01:00
{
return nullptr;
}
_freeIdList.pop_back();
PrepareNewEntity(entity, type);
return entity;
}
2022-02-12 23:31:06 +02:00
EntityBase* CreateEntityAt(const EntityId index, const EntityType type)
{
2023-01-16 20:24:52 +01:00
auto id = BinaryFind(std::rbegin(_freeIdList), std::rend(_freeIdList), index);
2022-03-08 19:49:43 +00:00
if (id == std::rend(_freeIdList))
{
return nullptr;
}
auto* entity = GetEntity(index);
if (entity == nullptr)
{
return nullptr;
}
_freeIdList.erase(std::next(id).base());
PrepareNewEntity(entity, type);
return entity;
}
2015-06-29 17:22:01 +01:00
template<typename T> void MiscUpdateAllType()
{
2021-03-16 11:18:06 +00:00
for (auto misc : EntityList<T>())
2018-06-22 23:17:03 +02:00
{
misc->Update();
2017-06-06 23:24:18 +02:00
}
}
template<typename... T> void MiscUpdateAllTypes()
{
(MiscUpdateAllType<T>(), ...);
}
2014-10-09 20:31:58 +01:00
/**
*
2015-12-11 09:38:37 -06:00
* rct2: 0x00672AA4
2014-10-09 20:31:58 +01:00
*/
2021-11-24 15:37:47 +02:00
void UpdateAllMiscEntities()
2014-10-09 20:31:58 +01:00
{
2022-01-18 10:21:20 -08:00
PROFILED_FUNCTION();
MiscUpdateAllTypes<
SteamParticle, MoneyEffect, VehicleCrashParticle, ExplosionCloud, CrashSplashParticle, ExplosionFlare, JumpingFountain,
Balloon, Duck>();
2014-09-20 16:18:02 +01:00
}
void UpdateMoneyEffect()
{
MiscUpdateAllTypes<MoneyEffect>();
}
// Performs a search to ensure that insert keeps next_in_quadrant in sprite_index order
2021-11-24 15:37:47 +02:00
static void EntitySpatialInsert(EntityBase* entity, const CoordsXY& newLoc)
{
2021-09-29 09:19:47 -07:00
size_t newIndex = GetSpatialIndexOffset(newLoc);
2021-11-24 15:27:48 +02:00
auto& spatialVector = gEntitySpatialIndex[newIndex];
2023-01-27 19:18:44 +02:00
auto index = std::lower_bound(std::begin(spatialVector), std::end(spatialVector), entity->Id);
spatialVector.insert(index, entity->Id);
}
2021-11-24 15:37:47 +02:00
static void EntitySpatialRemove(EntityBase* entity)
{
2021-11-24 15:37:47 +02:00
size_t currentIndex = GetSpatialIndexOffset({ entity->x, entity->y });
2021-11-24 15:27:48 +02:00
auto& spatialVector = gEntitySpatialIndex[currentIndex];
2023-01-27 19:18:44 +02:00
auto index = BinaryFind(std::begin(spatialVector), std::end(spatialVector), entity->Id);
2022-03-08 19:49:43 +00:00
if (index != std::end(spatialVector))
2021-01-23 07:36:46 +00:00
{
spatialVector.erase(index, index + 1);
}
else
{
LOG_WARNING("Bad sprite spatial index. Rebuilding the spatial index...");
2021-11-24 15:37:47 +02:00
ResetEntitySpatialIndices();
}
}
2021-11-24 15:37:47 +02:00
static void EntitySpatialMove(EntityBase* entity, const CoordsXY& newLoc)
{
2021-09-29 09:19:47 -07:00
size_t newIndex = GetSpatialIndexOffset(newLoc);
2021-11-24 15:37:47 +02:00
size_t currentIndex = GetSpatialIndexOffset({ entity->x, entity->y });
if (newIndex == currentIndex)
return;
2021-11-24 15:37:47 +02:00
EntitySpatialRemove(entity);
EntitySpatialInsert(entity, newLoc);
}
2021-08-25 17:42:09 +03:00
void EntityBase::MoveTo(const CoordsXYZ& newLocation)
{
if (x != LOCATION_NULL)
{
// Invalidate old position.
Invalidate();
}
2020-05-11 12:36:45 +02:00
auto loc = newLocation;
2022-10-12 06:35:20 +01:00
if (!MapIsLocationValid(loc))
2018-06-22 23:17:03 +02:00
{
2020-05-11 12:36:45 +02:00
loc.x = LOCATION_NULL;
2017-06-06 23:24:18 +02:00
}
2014-09-20 16:18:02 +01:00
2021-11-24 15:37:47 +02:00
EntitySpatialMove(this, loc);
2014-09-20 16:18:02 +01:00
2020-05-11 12:36:45 +02:00
if (loc.x == LOCATION_NULL)
2018-06-22 23:17:03 +02:00
{
2020-05-11 12:36:45 +02:00
x = loc.x;
y = loc.y;
z = loc.z;
2018-06-22 23:17:03 +02:00
}
else
{
2021-11-24 15:37:47 +02:00
EntitySetCoordinates(loc, this);
Invalidate(); // Invalidate new position.
2017-06-06 23:24:18 +02:00
}
2016-08-06 10:21:08 -06:00
}
2021-11-24 15:37:47 +02:00
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
2018-06-22 23:17:03 +02:00
{
2023-01-16 21:14:50 +01:00
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), entityPos);
2014-09-20 16:18:02 +01:00
entity->SpriteData.SpriteRect = ScreenRect(
2023-04-07 19:47:26 +03:00
screenCoords - ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMin },
screenCoords + ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMax });
2021-11-24 15:37:47 +02:00
entity->SetLocation(entityPos);
}
/**
* Frees any dynamically attached memory to the entity, such as peep name.
*/
2021-09-12 18:29:37 +02:00
static void FreeEntity(EntityBase& entity)
{
2021-09-12 18:29:37 +02:00
auto* guest = entity.As<Guest>();
auto* staff = entity.As<Staff>();
if (staff != nullptr)
{
staff->SetName({});
2021-10-27 21:19:10 +01:00
staff->ClearPatrolArea();
}
else if (guest != nullptr)
{
guest->SetName({});
2023-01-27 19:18:44 +02:00
OpenRCT2::RideUse::GetHistory().RemoveHandle(guest->Id);
OpenRCT2::RideUse::GetTypeHistory().RemoveHandle(guest->Id);
}
}
/**
*
* rct2: 0x0069EDB6
*/
2021-11-24 15:37:47 +02:00
void EntityRemove(EntityBase* entity)
{
2021-11-24 15:37:47 +02:00
FreeEntity(*entity);
2021-11-24 15:37:47 +02:00
EntityTweener::Get().RemoveEntity(entity);
RemoveFromEntityList(entity); // remove from existing list
2023-01-27 19:18:44 +02:00
AddToFreeList(entity->Id);
2021-11-24 15:37:47 +02:00
EntitySpatialRemove(entity);
EntityReset(entity);
}
/**
2021-11-24 15:37:47 +02:00
* Loops through all floating entities and removes them.
* Returns the amount of removed objects as feedback.
*/
2021-11-24 15:37:47 +02:00
uint16_t RemoveFloatingEntities()
{
uint16_t removed = 0;
2021-03-16 11:18:06 +00:00
for (auto* balloon : EntityList<Balloon>())
{
2021-11-24 15:37:47 +02:00
EntityRemove(balloon);
removed++;
}
2021-03-16 11:18:06 +00:00
for (auto* duck : EntityList<Duck>())
{
if (duck->IsFlying())
{
2021-11-24 15:37:47 +02:00
EntityRemove(duck);
removed++;
}
}
2021-03-16 11:18:06 +00:00
for (auto* money : EntityList<MoneyEffect>())
{
2021-11-24 15:37:47 +02:00
EntityRemove(money);
removed++;
}
return removed;
}
2021-11-24 15:37:47 +02:00
void EntitySetFlashing(EntityBase* entity, bool flashing)
{
2023-01-27 19:18:44 +02:00
assert(entity->Id.ToUnderlying() < MAX_ENTITIES);
_entityFlashingList[entity->Id.ToUnderlying()] = flashing;
}
2021-11-24 15:37:47 +02:00
bool EntityGetFlashing(EntityBase* entity)
{
2023-01-27 19:18:44 +02:00
assert(entity->Id.ToUnderlying() < MAX_ENTITIES);
return _entityFlashingList[entity->Id.ToUnderlying()];
}