mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 23:34:37 +01:00
Move painting for Duck entity
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "../audio/audio.h"
|
||||
#include "../core/DataSerialiser.h"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../paint/Paint.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/Surface.h"
|
||||
@@ -363,6 +364,15 @@ void Duck::Serialise(DataSerialiser& stream)
|
||||
stream << state;
|
||||
}
|
||||
|
||||
void Duck::Paint() const
|
||||
void Duck::Paint(paint_session* session, int32_t imageDirection) const
|
||||
{
|
||||
rct_drawpixelinfo& dpi = session->DPI;
|
||||
if (dpi.zoom_level > 1)
|
||||
return;
|
||||
|
||||
uint32_t imageId = GetFrameImage(imageDirection);
|
||||
if (imageId != 0)
|
||||
{
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
class DataSerialiser;
|
||||
struct CoordsXY;
|
||||
struct paint_session;
|
||||
|
||||
struct Duck : EntityBase
|
||||
{
|
||||
@@ -38,7 +39,7 @@ struct Duck : EntityBase
|
||||
bool IsFlying();
|
||||
void Remove();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
void Paint() const;
|
||||
void Paint(paint_session* session, int32_t imageDirection) const;
|
||||
|
||||
private:
|
||||
void UpdateFlyToWater();
|
||||
|
||||
@@ -149,18 +149,3 @@ template<> void PaintEntity(paint_session* session, const Balloon* balloon, int3
|
||||
imageId = imageId | (balloon->colour << 19) | IMAGE_TYPE_REMAP;
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, balloon->z }, { 1, 1, 0 });
|
||||
}
|
||||
|
||||
template<> void PaintEntity(paint_session* session, const Duck* duck, int32_t imageDirection)
|
||||
{
|
||||
rct_drawpixelinfo* dpi = &session->DPI;
|
||||
if (dpi->zoom_level <= 1)
|
||||
{
|
||||
if (duck == nullptr)
|
||||
return;
|
||||
uint32_t imageId = duck->GetFrameImage(imageDirection);
|
||||
if (imageId != 0)
|
||||
{
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, duck->z }, { 1, 1, 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user