2021-05-09 19:12:44 +01:00
|
|
|
/*****************************************************************************
|
2024-12-31 20:30:04 +01:00
|
|
|
* Copyright (c) 2014-2025 OpenRCT2 developers
|
2021-05-09 19:12:44 +01:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2021-11-26 16:49:37 +02:00
|
|
|
#include "EntityBase.h"
|
2021-05-09 19:12:44 +01:00
|
|
|
|
|
|
|
|
#include "../core/DataSerialiser.h"
|
2024-08-02 06:01:31 +01:00
|
|
|
#include "../interface/Viewport.h"
|
2021-05-09 19:12:44 +01:00
|
|
|
|
2024-07-26 09:59:58 +02:00
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
|
2021-11-27 15:12:57 +02:00
|
|
|
// Required for GetEntity to return a default
|
2024-10-29 16:54:01 +01:00
|
|
|
template<>
|
|
|
|
|
bool EntityBase::Is<EntityBase>() const
|
2021-11-27 15:12:57 +02:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EntityBase::Invalidate()
|
|
|
|
|
{
|
2024-07-26 18:23:25 +10:00
|
|
|
if (x == kLocationNull)
|
2021-11-27 15:12:57 +02:00
|
|
|
return;
|
|
|
|
|
|
2021-09-29 20:04:56 +02:00
|
|
|
ZoomLevel maxZoom{ 0 };
|
2021-11-27 15:12:57 +02:00
|
|
|
switch (Type)
|
|
|
|
|
{
|
|
|
|
|
case EntityType::Vehicle:
|
|
|
|
|
case EntityType::Guest:
|
|
|
|
|
case EntityType::Staff:
|
2021-09-29 20:04:56 +02:00
|
|
|
maxZoom = ZoomLevel{ 2 };
|
2021-11-27 15:12:57 +02:00
|
|
|
break;
|
|
|
|
|
case EntityType::CrashedVehicleParticle:
|
|
|
|
|
case EntityType::JumpingFountain:
|
2021-09-29 20:04:56 +02:00
|
|
|
maxZoom = ZoomLevel{ 0 };
|
2021-11-27 15:12:57 +02:00
|
|
|
break;
|
|
|
|
|
case EntityType::Duck:
|
2021-09-29 20:04:56 +02:00
|
|
|
maxZoom = ZoomLevel{ 1 };
|
2021-11-27 15:12:57 +02:00
|
|
|
break;
|
|
|
|
|
case EntityType::SteamParticle:
|
|
|
|
|
case EntityType::MoneyEffect:
|
|
|
|
|
case EntityType::ExplosionCloud:
|
|
|
|
|
case EntityType::CrashSplash:
|
|
|
|
|
case EntityType::ExplosionFlare:
|
|
|
|
|
case EntityType::Balloon:
|
2021-09-29 20:04:56 +02:00
|
|
|
maxZoom = ZoomLevel{ 2 };
|
2021-11-27 15:12:57 +02:00
|
|
|
break;
|
|
|
|
|
case EntityType::Litter:
|
2021-09-29 20:04:56 +02:00
|
|
|
maxZoom = ZoomLevel{ 0 };
|
2021-11-27 15:12:57 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-18 21:11:31 +02:00
|
|
|
ViewportsInvalidate(GetLocation(), SpriteData.Width, SpriteData.HeightMin, SpriteData.HeightMax, maxZoom);
|
2021-11-27 15:12:57 +02:00
|
|
|
}
|
|
|
|
|
|
2021-11-25 23:25:04 -08:00
|
|
|
void EntityBase::Serialise(DataSerialiser& stream)
|
2021-05-09 19:12:44 +01:00
|
|
|
{
|
2021-11-25 23:25:04 -08:00
|
|
|
stream << Type;
|
2023-01-27 19:18:44 +02:00
|
|
|
stream << Id;
|
2021-11-25 23:25:04 -08:00
|
|
|
stream << x;
|
|
|
|
|
stream << y;
|
|
|
|
|
stream << z;
|
2023-04-07 22:46:25 +03:00
|
|
|
stream << Orientation;
|
2021-05-09 19:12:44 +01:00
|
|
|
}
|
2021-11-27 15:20:17 +02:00
|
|
|
|
|
|
|
|
// Exists only for signature
|
|
|
|
|
void EntityBase::Paint() const
|
|
|
|
|
{
|
|
|
|
|
Guard::Assert(false, "You are not supposed to call this");
|
|
|
|
|
}
|