mirror of https://github.com/OpenRCT2/OpenRCT2.git
Pass dpi as ref when drawing object preview
This commit is contained in:
parent
ac2afdcfaf
commit
049164c400
|
@ -398,7 +398,7 @@ public:
|
|||
const auto clipHeight = bkWidget.height() - 1;
|
||||
if (ClipDrawPixelInfo(&clipDPI, &dpi, screenPos, clipWidth, clipHeight))
|
||||
{
|
||||
object->DrawPreview(&clipDPI, clipWidth, clipHeight);
|
||||
object->DrawPreview(clipDPI, clipWidth, clipHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1057,7 +1057,7 @@ public:
|
|||
int32_t _height = previewWidget.height() - 1;
|
||||
if (ClipDrawPixelInfo(&clipDPI, &dpi, screenPos, _width, _height))
|
||||
{
|
||||
_loadedObject->DrawPreview(&clipDPI, _width, _height);
|
||||
_loadedObject->DrawPreview(clipDPI, _width, _height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,15 +74,15 @@ void BannerObject::Unload()
|
|||
_legacyType.image = 0;
|
||||
}
|
||||
|
||||
void BannerObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void BannerObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
|
||||
auto image0 = ImageId(_legacyType.image, COLOUR_BORDEAUX_RED);
|
||||
auto image1 = ImageId(_legacyType.image + 1, COLOUR_BORDEAUX_RED);
|
||||
|
||||
GfxDrawSprite(dpi, image0, screenCoords + ScreenCoordsXY{ -12, 8 });
|
||||
GfxDrawSprite(dpi, image1, screenCoords + ScreenCoordsXY{ -12, 8 });
|
||||
GfxDrawSprite(&dpi, image0, screenCoords + ScreenCoordsXY{ -12, 8 });
|
||||
GfxDrawSprite(&dpi, image1, screenCoords + ScreenCoordsXY{ -12, 8 });
|
||||
}
|
||||
|
||||
void BannerObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -29,5 +29,5 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
};
|
||||
|
|
|
@ -42,13 +42,13 @@ void EntranceObject::Unload()
|
|||
_legacyType.image_id = 0;
|
||||
}
|
||||
|
||||
void EntranceObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void EntranceObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
|
||||
GfxDrawSprite(dpi, ImageId(_legacyType.image_id + 1), screenCoords + ScreenCoordsXY{ -32, 14 });
|
||||
GfxDrawSprite(dpi, ImageId(_legacyType.image_id + 0), screenCoords + ScreenCoordsXY{ 0, 28 });
|
||||
GfxDrawSprite(dpi, ImageId(_legacyType.image_id + 2), screenCoords + ScreenCoordsXY{ 32, 44 });
|
||||
GfxDrawSprite(&dpi, ImageId(_legacyType.image_id + 1), screenCoords + ScreenCoordsXY{ -32, 14 });
|
||||
GfxDrawSprite(&dpi, ImageId(_legacyType.image_id + 0), screenCoords + ScreenCoordsXY{ 0, 28 });
|
||||
GfxDrawSprite(&dpi, ImageId(_legacyType.image_id + 2), screenCoords + ScreenCoordsXY{ 32, 44 });
|
||||
}
|
||||
|
||||
void EntranceObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
ImageIndex GetImage(uint8_t sequence, Direction direction) const;
|
||||
uint8_t GetScrollingMode() const;
|
||||
|
|
|
@ -80,10 +80,10 @@ void FootpathItemObject::Unload()
|
|||
_legacyType.image = 0;
|
||||
}
|
||||
|
||||
void FootpathItemObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void FootpathItemObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
GfxDrawSprite(dpi, ImageId(_legacyType.image), screenCoords - ScreenCoordsXY{ 22, 24 });
|
||||
GfxDrawSprite(&dpi, ImageId(_legacyType.image), screenCoords - ScreenCoordsXY{ 22, 24 });
|
||||
}
|
||||
|
||||
static PathBitDrawType ParseDrawType(const std::string& s)
|
||||
|
|
|
@ -28,5 +28,5 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
};
|
||||
|
|
|
@ -69,11 +69,11 @@ void FootpathObject::Unload()
|
|||
_legacyType.image = 0;
|
||||
}
|
||||
|
||||
void FootpathObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void FootpathObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
GfxDrawSprite(dpi, ImageId(_pathSurfaceDescriptor.PreviewImage), screenCoords - ScreenCoordsXY{ 49, 17 });
|
||||
GfxDrawSprite(dpi, ImageId(_queueSurfaceDescriptor.PreviewImage), screenCoords + ScreenCoordsXY{ 4, -17 });
|
||||
GfxDrawSprite(&dpi, ImageId(_pathSurfaceDescriptor.PreviewImage), screenCoords - ScreenCoordsXY{ 49, 17 });
|
||||
GfxDrawSprite(&dpi, ImageId(_queueSurfaceDescriptor.PreviewImage), screenCoords + ScreenCoordsXY{ 4, -17 });
|
||||
}
|
||||
|
||||
void FootpathObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -52,5 +52,5 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ void FootpathRailingsObject::Unload()
|
|||
RailingsImageId = 0;
|
||||
}
|
||||
|
||||
void FootpathRailingsObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void FootpathRailingsObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto x = width / 2;
|
||||
auto y = height / 2;
|
||||
|
@ -61,20 +61,20 @@ void FootpathRailingsObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int3
|
|||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
auto h = i * 16;
|
||||
GfxDrawSprite(dpi, img, { x - 8, y + 8 + h });
|
||||
GfxDrawSprite(dpi, img, { x + 8, y + 16 + h });
|
||||
GfxDrawSprite(&dpi, img, { x - 8, y + 8 + h });
|
||||
GfxDrawSprite(&dpi, img, { x + 8, y + 16 + h });
|
||||
}
|
||||
|
||||
GfxDrawSprite(dpi, helper.WithIndex(BridgeImageId + 5), { x, y - 17 });
|
||||
GfxDrawSprite(dpi, ImageId(RailingsImageId + 1), { x + 4, y - 14 });
|
||||
GfxDrawSprite(dpi, ImageId(RailingsImageId + 1), { x + 27, y - 2 });
|
||||
GfxDrawSprite(&dpi, helper.WithIndex(BridgeImageId + 5), { x, y - 17 });
|
||||
GfxDrawSprite(&dpi, ImageId(RailingsImageId + 1), { x + 4, y - 14 });
|
||||
GfxDrawSprite(&dpi, ImageId(RailingsImageId + 1), { x + 27, y - 2 });
|
||||
}
|
||||
else
|
||||
{
|
||||
GfxDrawSprite(dpi, helper.WithIndex(BridgeImageId + 22), { x + 0, y + 16 });
|
||||
GfxDrawSprite(dpi, helper.WithIndex(BridgeImageId + 49), { x, y - 17 });
|
||||
GfxDrawSprite(dpi, ImageId(RailingsImageId + 1), { x + 4, y - 14 });
|
||||
GfxDrawSprite(dpi, ImageId(RailingsImageId + 1), { x + 27, y - 3 });
|
||||
GfxDrawSprite(&dpi, helper.WithIndex(BridgeImageId + 22), { x + 0, y + 16 });
|
||||
GfxDrawSprite(&dpi, helper.WithIndex(BridgeImageId + 49), { x, y - 17 });
|
||||
GfxDrawSprite(&dpi, ImageId(RailingsImageId + 1), { x + 4, y - 14 });
|
||||
GfxDrawSprite(&dpi, ImageId(RailingsImageId + 1), { x + 27, y - 3 });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
const PathRailingsDescriptor& GetDescriptor() const
|
||||
{
|
||||
|
|
|
@ -43,12 +43,12 @@ void FootpathSurfaceObject::Unload()
|
|||
BaseImageId = 0;
|
||||
}
|
||||
|
||||
void FootpathSurfaceObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void FootpathSurfaceObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2 - 16, height / 2 };
|
||||
GfxDrawSprite(dpi, ImageId(BaseImageId + 3), screenCoords);
|
||||
GfxDrawSprite(dpi, ImageId(BaseImageId + 16), { screenCoords.x + 32, screenCoords.y - 16 });
|
||||
GfxDrawSprite(dpi, ImageId(BaseImageId + 8), { screenCoords.x + 32, screenCoords.y + 16 });
|
||||
GfxDrawSprite(&dpi, ImageId(BaseImageId + 3), screenCoords);
|
||||
GfxDrawSprite(&dpi, ImageId(BaseImageId + 16), { screenCoords.x + 32, screenCoords.y - 16 });
|
||||
GfxDrawSprite(&dpi, ImageId(BaseImageId + 8), { screenCoords.x + 32, screenCoords.y + 16 });
|
||||
}
|
||||
|
||||
void FootpathSurfaceObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
void SetRepositoryItem(ObjectRepositoryItem* item) const override;
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ void LargeSceneryObject::Unload()
|
|||
_baseImageId = _legacyType.image = 0;
|
||||
}
|
||||
|
||||
void LargeSceneryObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void LargeSceneryObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, (height / 2) - 39 };
|
||||
|
||||
|
@ -155,7 +155,7 @@ void LargeSceneryObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t
|
|||
if (_legacyType.flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR)
|
||||
image = image.WithTertiary(COLOUR_DARK_BROWN);
|
||||
|
||||
GfxDrawSprite(dpi, image, screenCoords);
|
||||
GfxDrawSprite(&dpi, image, screenCoords);
|
||||
}
|
||||
|
||||
std::vector<LargeSceneryTile> LargeSceneryObject::ReadTiles(OpenRCT2::IStream* stream)
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
const LargeSceneryTile* GetTileForSequence(uint8_t SequenceIndex) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -87,15 +87,15 @@ void MusicObject::Unload()
|
|||
NameStringId = 0;
|
||||
}
|
||||
|
||||
void MusicObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void MusicObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
// Write (no image)
|
||||
int32_t x = width / 2;
|
||||
int32_t y = height / 2;
|
||||
if (_hasPreview)
|
||||
GfxDrawSprite(dpi, ImageId(_previewImageId), { 0, 0 });
|
||||
GfxDrawSprite(&dpi, ImageId(_previewImageId), { 0, 0 });
|
||||
else
|
||||
DrawTextBasic(*dpi, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE });
|
||||
DrawTextBasic(dpi, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
void MusicObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
std::optional<uint8_t> GetOriginalStyleId() const;
|
||||
bool SupportsRideType(ride_type_t rideType);
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
virtual void Load() abstract;
|
||||
virtual void Unload() abstract;
|
||||
|
||||
virtual void DrawPreview(DrawPixelInfo* /*dpi*/, int32_t /*width*/, int32_t /*height*/) const
|
||||
virtual void DrawPreview(DrawPixelInfo& /*dpi*/, int32_t /*width*/, int32_t /*height*/) const
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ void RideObject::Unload()
|
|||
_legacyType.images_offset = 0;
|
||||
}
|
||||
|
||||
void RideObject::DrawPreview(DrawPixelInfo* dpi, [[maybe_unused]] int32_t width, [[maybe_unused]] int32_t height) const
|
||||
void RideObject::DrawPreview(DrawPixelInfo& dpi, [[maybe_unused]] int32_t width, [[maybe_unused]] int32_t height) const
|
||||
{
|
||||
uint32_t imageId = _legacyType.images_offset;
|
||||
|
||||
|
@ -346,7 +346,7 @@ void RideObject::DrawPreview(DrawPixelInfo* dpi, [[maybe_unused]] int32_t width,
|
|||
imageId++;
|
||||
}
|
||||
|
||||
GfxDrawSprite(dpi, ImageId(imageId), { 0, 0 });
|
||||
GfxDrawSprite(&dpi, ImageId(imageId), { 0, 0 });
|
||||
}
|
||||
|
||||
std::string RideObject::GetDescription() const
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
std::string GetDescription() const;
|
||||
std::string GetCapacity() const;
|
||||
|
|
|
@ -71,12 +71,12 @@ void SceneryGroupObject::Unload()
|
|||
_legacyType.image = 0;
|
||||
}
|
||||
|
||||
void SceneryGroupObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void SceneryGroupObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
|
||||
const auto imageId = ImageId(_legacyType.image + 1, COLOUR_DARK_GREEN);
|
||||
GfxDrawSprite(dpi, imageId, screenCoords - ScreenCoordsXY{ 15, 14 });
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords - ScreenCoordsXY{ 15, 14 });
|
||||
}
|
||||
|
||||
static std::optional<uint8_t> GetSceneryType(const ObjectType type)
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
void Unload() override;
|
||||
void UpdateEntryIndexes();
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
void SetRepositoryItem(ObjectRepositoryItem* item) const override;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ void SmallSceneryObject::Unload()
|
|||
_legacyType.image = 0;
|
||||
}
|
||||
|
||||
void SmallSceneryObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void SmallSceneryObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto imageId = ImageId(_legacyType.image);
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR))
|
||||
|
@ -119,12 +119,12 @@ void SmallSceneryObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t
|
|||
screenCoords.y -= 12;
|
||||
}
|
||||
|
||||
GfxDrawSprite(dpi, imageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords);
|
||||
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_HAS_GLASS))
|
||||
{
|
||||
imageId = ImageId(_legacyType.image + 4).WithTransparency(COLOUR_BORDEAUX_RED);
|
||||
GfxDrawSprite(dpi, imageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords);
|
||||
}
|
||||
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_ANIMATED_FG))
|
||||
|
@ -134,7 +134,7 @@ void SmallSceneryObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t
|
|||
{
|
||||
imageId = imageId.WithSecondary(COLOUR_YELLOW);
|
||||
}
|
||||
GfxDrawSprite(dpi, imageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
private:
|
||||
static std::vector<uint8_t> ReadFrameOffsets(OpenRCT2::IStream* stream);
|
||||
|
|
|
@ -45,7 +45,7 @@ void StationObject::Unload()
|
|||
ShelterImageId = ImageIndexUndefined;
|
||||
}
|
||||
|
||||
void StationObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void StationObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, (height / 2) + 16 };
|
||||
|
||||
|
@ -64,16 +64,16 @@ void StationObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t heigh
|
|||
imageId = imageId.WithSecondary(colour1);
|
||||
}
|
||||
|
||||
GfxDrawSprite(dpi, imageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords);
|
||||
if (Flags & STATION_OBJECT_FLAGS::IS_TRANSPARENT)
|
||||
{
|
||||
GfxDrawSprite(dpi, tImageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, tImageId, screenCoords);
|
||||
}
|
||||
|
||||
GfxDrawSprite(dpi, imageId.WithIndexOffset(4), screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId.WithIndexOffset(4), screenCoords);
|
||||
if (Flags & STATION_OBJECT_FLAGS::IS_TRANSPARENT)
|
||||
{
|
||||
GfxDrawSprite(dpi, tImageId.WithIndexOffset(4), screenCoords);
|
||||
GfxDrawSprite(&dpi, tImageId.WithIndexOffset(4), screenCoords);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,5 +35,5 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
};
|
||||
|
|
|
@ -38,13 +38,13 @@ void TerrainEdgeObject::Unload()
|
|||
BaseImageId = 0;
|
||||
}
|
||||
|
||||
void TerrainEdgeObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void TerrainEdgeObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
|
||||
auto imageId = ImageId(BaseImageId + 5);
|
||||
GfxDrawSprite(dpi, imageId, screenCoords + ScreenCoordsXY{ 8, -8 });
|
||||
GfxDrawSprite(dpi, imageId, screenCoords + ScreenCoordsXY{ 8, 8 });
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords + ScreenCoordsXY{ 8, -8 });
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords + ScreenCoordsXY{ 8, 8 });
|
||||
}
|
||||
|
||||
void TerrainEdgeObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
static TerrainEdgeObject* GetById(ObjectEntryIndex entryIndex);
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ void TerrainSurfaceObject::Unload()
|
|||
NumEntries = 0;
|
||||
}
|
||||
|
||||
void TerrainSurfaceObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void TerrainSurfaceObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto imageId = ImageId(GetImageId({}, 1, 0, 0, false, false));
|
||||
if (Colour != 255)
|
||||
|
@ -70,7 +70,7 @@ void TerrainSurfaceObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_
|
|||
}
|
||||
for (int32_t j = 0; j < 4; j++)
|
||||
{
|
||||
GfxDrawSprite(dpi, imageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords);
|
||||
screenCoords.x += 64;
|
||||
}
|
||||
screenCoords.y += 16;
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
uint32_t GetImageId(
|
||||
const CoordsXY& position, int32_t length, int32_t rotation, int32_t offset, bool grid, bool underground) const;
|
||||
|
|
|
@ -68,7 +68,7 @@ void WallObject::Unload()
|
|||
_legacyType.image = 0;
|
||||
}
|
||||
|
||||
void WallObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void WallObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
|
||||
|
@ -81,16 +81,16 @@ void WallObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height)
|
|||
imageId = imageId.WithSecondary(COLOUR_YELLOW);
|
||||
}
|
||||
|
||||
GfxDrawSprite(dpi, imageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId, screenCoords);
|
||||
|
||||
if (_legacyType.flags & WALL_SCENERY_HAS_GLASS)
|
||||
{
|
||||
auto glassImageId = imageId.WithTransparency(COLOUR_BORDEAUX_RED).WithIndexOffset(6);
|
||||
GfxDrawSprite(dpi, glassImageId, screenCoords);
|
||||
GfxDrawSprite(&dpi, glassImageId, screenCoords);
|
||||
}
|
||||
else if (_legacyType.flags & WALL_SCENERY_IS_DOOR)
|
||||
{
|
||||
GfxDrawSprite(dpi, imageId.WithIndexOffset(1), screenCoords);
|
||||
GfxDrawSprite(&dpi, imageId.WithIndexOffset(1), screenCoords);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,5 +28,5 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
};
|
||||
|
|
|
@ -54,11 +54,11 @@ void WaterObject::Unload()
|
|||
_legacyType.image_id = 0;
|
||||
}
|
||||
|
||||
void WaterObject::DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const
|
||||
void WaterObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
// Write (no image)
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
DrawTextBasic(*dpi, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE });
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void Load() override;
|
||||
void Unload() override;
|
||||
|
||||
void DrawPreview(DrawPixelInfo* dpi, int32_t width, int32_t height) const override;
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
|
||||
private:
|
||||
void ReadJsonPalette(json_t& jPalette);
|
||||
|
|
Loading…
Reference in New Issue