1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 05:23:04 +01:00

Expose obj image offset and num images to plugins (#17567)

Co-authored-by: Duncan <duncans_pumpkin@hotmail.co.uk>
This commit is contained in:
Nikolas Parshook
2023-04-13 15:09:15 -04:00
committed by GitHub
parent d0c7d0f6fb
commit ef35dfa40a
22 changed files with 106 additions and 52 deletions

View File

@@ -15,6 +15,7 @@
#include "../core/Memory.hpp"
#include "../core/String.hpp"
#include "../core/ZipStream.hpp"
#include "../drawing/Image.h"
#include "../localisation/Language.h"
#include "../localisation/LocalisationService.h"
#include "../localisation/StringIds.h"
@@ -182,6 +183,23 @@ std::string Object::GetName(int32_t language) const
return GetString(language, ObjectStringID::NAME);
}
ImageIndex Object::LoadImages()
{
if (_baseImageId == ImageIndexUndefined)
{
_baseImageId = GfxObjectAllocateImages(GetImageTable().GetImages(), GetImageTable().GetCount());
}
return _baseImageId;
}
void Object::UnloadImages()
{
if (_baseImageId != ImageIndexUndefined)
{
GfxObjectFreeImages(_baseImageId, GetImageTable().GetCount());
}
}
void RCTObjectEntry::SetName(std::string_view value)
{
std::memset(name, ' ', sizeof(name));