Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmdsprite 2 #13590

Merged
merged 15 commits into from
Dec 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions src/openrct2/CmdlineSprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "object/ObjectRepository.h"
#include "platform/platform.h"
#include "util/Util.h"
#include "world/Entrance.h"
#include "world/Scenery.h"

#include <cmath>
#include <cstring>
Expand All @@ -36,22 +34,10 @@

using namespace OpenRCT2::Drawing;

#pragma pack(push, 1)
duncanspumpkin marked this conversation as resolved.
Show resolved Hide resolved

struct rct_sprite_file_header
{
uint32_t num_entries;
uint32_t total_size;
};

assert_struct_size(rct_sprite_file_header, 8);

#pragma pack(pop)

struct SpriteFile
{
public:
rct_sprite_file_header Header;
rct_g1_header Header;
std::vector<rct_g1_element> Entries;
std::vector<uint8_t> Data;
void AddImage(ImageImporter::ImportResult& image);
Expand Down Expand Up @@ -99,7 +85,7 @@ std::optional<SpriteFile> SpriteFile::Open(const utf8* path)
OpenRCT2::FileStream stream(path, OpenRCT2::FILE_MODE_OPEN);

SpriteFile sFile;
stream.Read(&sFile.Header, sizeof(rct_sprite_file_header));
stream.Read(&sFile.Header, sizeof(rct_g1_header));

if (sFile.Header.num_entries > 0)
{
Expand All @@ -124,7 +110,7 @@ bool SpriteFile::Save(const utf8* path)
try
{
OpenRCT2::FileStream stream(path, OpenRCT2::FILE_MODE_WRITE);
stream.Write(&Header, sizeof(rct_sprite_file_header));
stream.Write(&Header, sizeof(rct_g1_header));

if (Header.num_entries > 0)
{
Expand Down