mirror of https://github.com/OpenRCT2/OpenRCT2.git
create base scenery object for scenery objects
This commit is contained in:
parent
234471c3fc
commit
440c021951
|
@ -449,6 +449,7 @@
|
|||
<ClInclude Include="src\object\ObjectRepository.h" />
|
||||
<ClInclude Include="src\object\RideObject.h" />
|
||||
<ClInclude Include="src\object\SceneryGroupObject.h" />
|
||||
<ClInclude Include="src\object\SceneryObject.h" />
|
||||
<ClInclude Include="src\object\SmallSceneryObject.h" />
|
||||
<ClInclude Include="src\object\StexObject.h" />
|
||||
<ClInclude Include="src\object\StringTable.h" />
|
||||
|
|
|
@ -39,7 +39,8 @@ void BannerObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
|||
|
||||
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
|
||||
|
||||
_sceneryTabEntry = stream->ReadValue<rct_object_entry>();
|
||||
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
|
||||
SetPrimarySceneryGroup(&sgEntry);
|
||||
|
||||
GetImageTable()->Read(context, stream);
|
||||
|
||||
|
@ -54,16 +55,6 @@ void BannerObject::Load()
|
|||
{
|
||||
_legacyType.name = language_allocate_object_string(GetName());
|
||||
_legacyType.image = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount());
|
||||
|
||||
_legacyType.banner.scenery_tab_id = 0xFF;
|
||||
if ((_sceneryTabEntry.flags & 0xFF) != 0xFF)
|
||||
{
|
||||
uint8 entryType, entryIndex;
|
||||
if (find_object_in_entry_group(&_sceneryTabEntry, &entryType, &entryIndex))
|
||||
{
|
||||
_legacyType.banner.scenery_tab_id = entryIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BannerObject::Unload()
|
||||
|
|
|
@ -16,21 +16,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
#include "SceneryObject.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
class BannerObject : public Object
|
||||
class BannerObject : public SceneryObject
|
||||
{
|
||||
private:
|
||||
rct_scenery_entry _legacyType = { 0 };
|
||||
rct_object_entry _sceneryTabEntry = { 0 };
|
||||
|
||||
public:
|
||||
explicit BannerObject(const rct_object_entry &entry) : Object(entry) { };
|
||||
explicit BannerObject(const rct_object_entry &entry) : SceneryObject(entry) { };
|
||||
|
||||
void * GetLegacyData() override { return &_legacyType; }
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext * context, IStream * stre
|
|||
|
||||
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
|
||||
|
||||
_sceneryTabEntry = stream->ReadValue<rct_object_entry>();
|
||||
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
|
||||
SetPrimarySceneryGroup(&sgEntry);
|
||||
|
||||
GetImageTable()->Read(context, stream);
|
||||
|
||||
|
@ -56,14 +57,6 @@ void FootpathItemObject::Load()
|
|||
_legacyType.image = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount());
|
||||
|
||||
_legacyType.path_bit.scenery_tab_id = 0xFF;
|
||||
if ((_sceneryTabEntry.flags & 0xFF) != 0xFF)
|
||||
{
|
||||
uint8 entryType, entryIndex;
|
||||
if (find_object_in_entry_group(&_sceneryTabEntry, &entryType, &entryIndex))
|
||||
{
|
||||
_legacyType.path_bit.scenery_tab_id = entryIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FootpathItemObject::Unload()
|
||||
|
|
|
@ -16,21 +16,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
#include "SceneryObject.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
class FootpathItemObject : public Object
|
||||
class FootpathItemObject : public SceneryObject
|
||||
{
|
||||
private:
|
||||
rct_scenery_entry _legacyType = { 0 };
|
||||
rct_object_entry _sceneryTabEntry = { 0 };
|
||||
|
||||
public:
|
||||
explicit FootpathItemObject(const rct_object_entry &entry) : Object(entry) { };
|
||||
explicit FootpathItemObject(const rct_object_entry &entry) : SceneryObject(entry) { };
|
||||
|
||||
void * GetLegacyData() override { return &_legacyType; }
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ void LargeSceneryObject::ReadLegacy(IReadObjectContext * context, IStream * stre
|
|||
|
||||
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
|
||||
|
||||
_sceneryTabEntry = stream->ReadValue<rct_object_entry>();
|
||||
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
|
||||
SetPrimarySceneryGroup(&sgEntry);
|
||||
|
||||
if (_legacyType.large_scenery.flags & (1 << 2))
|
||||
{
|
||||
|
@ -86,16 +87,6 @@ void LargeSceneryObject::Load()
|
|||
|
||||
_legacyType.large_scenery.tiles = _tiles;
|
||||
|
||||
_legacyType.large_scenery.scenery_tab_id = 0xFF;
|
||||
if ((_sceneryTabEntry.flags & 0xFF) != 0xFF)
|
||||
{
|
||||
uint8 entryType, entryIndex;
|
||||
if (find_object_in_entry_group(&_sceneryTabEntry, &entryType, &entryIndex))
|
||||
{
|
||||
_legacyType.large_scenery.scenery_tab_id = entryIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (_legacyType.large_scenery.flags & (1 << 2))
|
||||
{
|
||||
_legacyType.large_scenery.text_image = _legacyType.image;
|
||||
|
|
|
@ -16,24 +16,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
#include "SceneryObject.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
class LargeSceneryObject : public Object
|
||||
class LargeSceneryObject : public SceneryObject
|
||||
{
|
||||
private:
|
||||
rct_scenery_entry _legacyType = { 0 };
|
||||
uint32 _baseImageId = 0;
|
||||
rct_object_entry _sceneryTabEntry = { 0 };
|
||||
rct_large_scenery_text * _3dFont = nullptr;
|
||||
rct_large_scenery_tile * _tiles = nullptr;
|
||||
|
||||
public:
|
||||
explicit LargeSceneryObject(const rct_object_entry &entry) : Object(entry) { };
|
||||
explicit LargeSceneryObject(const rct_object_entry &entry) : SceneryObject(entry) { };
|
||||
~LargeSceneryObject();
|
||||
|
||||
void * GetLegacyData() override { return &_legacyType; }
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
class SceneryObject : public Object
|
||||
{
|
||||
private:
|
||||
rct_object_entry _primarySceneryGroupEntry = { 0 };
|
||||
|
||||
public:
|
||||
explicit SceneryObject(const rct_object_entry &entry) : Object(entry) { }
|
||||
virtual ~SceneryObject() { }
|
||||
|
||||
const rct_object_entry * GetPrimarySceneryGroup() { return &_primarySceneryGroupEntry; }
|
||||
|
||||
protected:
|
||||
void SetPrimarySceneryGroup(const rct_object_entry * entry) { _primarySceneryGroupEntry = *entry; }
|
||||
};
|
|
@ -51,7 +51,8 @@ void SmallSceneryObject::ReadLegacy(IReadObjectContext * context, IStream * stre
|
|||
|
||||
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
|
||||
|
||||
_sceneryTabEntry = stream->ReadValue<rct_object_entry>();
|
||||
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
|
||||
SetPrimarySceneryGroup(&sgEntry);
|
||||
|
||||
if (_legacyType.small_scenery.flags & SMALL_SCENERY_FLAG16)
|
||||
{
|
||||
|
@ -82,14 +83,6 @@ void SmallSceneryObject::Load()
|
|||
_legacyType.image = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount());
|
||||
|
||||
_legacyType.small_scenery.scenery_tab_id = 0xFF;
|
||||
if ((_sceneryTabEntry.flags & 0xFF) != 0xFF)
|
||||
{
|
||||
uint8 entryType, entryIndex;
|
||||
if (find_object_in_entry_group(&_sceneryTabEntry, &entryType, &entryIndex))
|
||||
{
|
||||
_legacyType.small_scenery.scenery_tab_id = entryIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (_legacyType.small_scenery.flags & SMALL_SCENERY_FLAG16)
|
||||
{
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
#include "SceneryObject.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
class SmallSceneryObject : public Object
|
||||
class SmallSceneryObject : public SceneryObject
|
||||
{
|
||||
private:
|
||||
rct_scenery_entry _legacyType = { 0 };
|
||||
rct_object_entry _sceneryTabEntry = { 0 };
|
||||
uint8 * _var10data = nullptr;
|
||||
|
||||
public:
|
||||
explicit SmallSceneryObject(const rct_object_entry &entry) : Object(entry) { };
|
||||
explicit SmallSceneryObject(const rct_object_entry &entry) : SceneryObject(entry) { };
|
||||
~SmallSceneryObject();
|
||||
|
||||
void * GetLegacyData() override { return &_legacyType; }
|
||||
|
|
|
@ -42,7 +42,8 @@ void WallObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
|||
|
||||
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
|
||||
|
||||
_sceneryTabEntry = stream->ReadValue<rct_object_entry>();
|
||||
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
|
||||
SetPrimarySceneryGroup(&sgEntry);
|
||||
|
||||
GetImageTable()->Read(context, stream);
|
||||
|
||||
|
@ -57,16 +58,6 @@ void WallObject::Load()
|
|||
{
|
||||
_legacyType.name = language_allocate_object_string(GetName());
|
||||
_legacyType.image = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount());
|
||||
|
||||
_legacyType.small_scenery.scenery_tab_id = 0xFF;
|
||||
if ((_sceneryTabEntry.flags & 0xFF) != 0xFF)
|
||||
{
|
||||
uint8 entryType, entryIndex;
|
||||
if (find_object_in_entry_group(&_sceneryTabEntry, &entryType, &entryIndex))
|
||||
{
|
||||
_legacyType.small_scenery.scenery_tab_id = entryIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WallObject::Unload()
|
||||
|
|
|
@ -16,21 +16,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
#include "SceneryObject.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
class WallObject : public Object
|
||||
class WallObject : public SceneryObject
|
||||
{
|
||||
private:
|
||||
rct_scenery_entry _legacyType = { 0 };
|
||||
rct_object_entry _sceneryTabEntry = { 0 };
|
||||
|
||||
public:
|
||||
explicit WallObject(const rct_object_entry &entry) : Object(entry) { };
|
||||
explicit WallObject(const rct_object_entry &entry) : SceneryObject(entry) { };
|
||||
|
||||
void * GetLegacyData() override { return &_legacyType; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue