Move painting for Balloon entity

This commit is contained in:
ζeh Matt 2021-11-27 15:29:33 +02:00
parent eaff0a343d
commit 30349f80f5
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
3 changed files with 12 additions and 16 deletions

View File

@ -13,6 +13,7 @@
#include "../audio/audio.h"
#include "../core/DataSerialiser.h"
#include "../network/network.h"
#include "../paint/Paint.h"
#include "../scenario/Scenario.h"
#include "../util/Util.h"
#include "EntityRegistry.h"
@ -107,6 +108,14 @@ void Balloon::Serialise(DataSerialiser& stream)
stream << colour;
}
void Balloon::Paint() const
void Balloon::Paint(paint_session* session, int32_t imageDirection) const
{
uint32_t imageId = 22651 + (frame & 7);
if (popped != 0)
{
imageId += 8;
}
imageId = imageId | (colour << 19) | IMAGE_TYPE_REMAP;
PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 1, 1, 0 });
}

View File

@ -13,6 +13,7 @@
class DataSerialiser;
struct CoordsXYZ;
struct paint_session;
struct Balloon : EntityBase
{
@ -26,5 +27,5 @@ struct Balloon : EntityBase
void Pop();
void Press();
void Serialise(DataSerialiser& stream);
void Paint() const;
void Paint(paint_session* session, int32_t imageDirection) const;
};

View File

@ -135,17 +135,3 @@ template<> void PaintEntity(paint_session* session, const JumpingFountain* jumpi
PaintAddImageAsParentRotated(session, ebx, imageId, 0, 0, 32, 1, 3, height, bb[ebx & 1].x, bb[ebx & 1].y, height);
}
template<> void PaintEntity(paint_session* session, const Balloon* balloon, int32_t imageDirection)
{
if (balloon == nullptr)
return;
uint32_t imageId = 22651 + (balloon->frame & 7);
if (balloon->popped != 0)
{
imageId += 8;
}
imageId = imageId | (balloon->colour << 19) | IMAGE_TYPE_REMAP;
PaintAddImageAsParent(session, imageId, { 0, 0, balloon->z }, { 1, 1, 0 });
}