mirror of https://github.com/OpenRCT2/OpenRCT2.git
Allow adding images to MusicObjects
This commit is contained in:
parent
3f3c759c7d
commit
23a8914de7
|
@ -4,6 +4,7 @@
|
|||
- Improved: [#18192] Tycoon Park has been added Extras tab.
|
||||
- Improved: [#18214] Competition scenarios have received their own section.
|
||||
- Improved: [#18250] Added modern style file and folder pickers on Windows.
|
||||
- Improved: [#18422] Allow adding images to music objects.
|
||||
- Change: [#18230] Make the large flat to steep pieces available on the corkscrew roller coaster without cheats.
|
||||
- Change: [#18381] Convert custom invisible paths to the built-in ones.
|
||||
- Fix: [#14312] Research ride type message incorrect.
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "../core/IStream.hpp"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../drawing/Image.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "RideObject.h"
|
||||
|
@ -71,6 +72,9 @@ void MusicObject::Load()
|
|||
track.Size = track.Asset.GetSize();
|
||||
}
|
||||
}
|
||||
|
||||
_hasPreview = !!GetImageTable().GetCount();
|
||||
_previewImageId = gfx_object_allocate_images(GetImageTable().GetImages(), GetImageTable().GetCount());
|
||||
}
|
||||
|
||||
void MusicObject::Unload()
|
||||
|
@ -84,7 +88,10 @@ void MusicObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t hei
|
|||
// Write (no image)
|
||||
int32_t x = width / 2;
|
||||
int32_t y = height / 2;
|
||||
DrawTextBasic(dpi, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE });
|
||||
if (_hasPreview)
|
||||
gfx_draw_sprite(dpi, ImageId(_previewImageId), { 0, 0 });
|
||||
else
|
||||
DrawTextBasic(dpi, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
void MusicObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
|
|
|
@ -49,6 +49,8 @@ private:
|
|||
MusicNiceFactor _niceFactor;
|
||||
AudioSampleTable _sampleTable;
|
||||
AudioSampleTable _loadedSampleTable;
|
||||
bool _hasPreview{};
|
||||
uint32_t _previewImageId{};
|
||||
|
||||
public:
|
||||
StringId NameStringId{};
|
||||
|
|
Loading…
Reference in New Issue