OpenTTD Source 20241224-master-gf74b0cf984
sprite_file_type.hpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD 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, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef SPRITE_FILE_TYPE_HPP
11#define SPRITE_FILE_TYPE_HPP
12
13#include "../random_access_file_type.h"
14
23public:
24 SpriteFile(const std::string &filename, Subdirectory subdir, bool palette_remap);
25 SpriteFile(const SpriteFile&) = delete;
26 void operator=(const SpriteFile&) = delete;
27
32 bool NeedsPaletteRemap() const { return this->palette_remap; }
33
38 uint8_t GetContainerVersion() const { return this->container_version; }
39
43 void SeekToBegin() { this->SeekTo(this->content_begin, SEEK_SET); }
44};
45
46#endif /* SPRITE_FILE_TYPE_HPP */
A file from which bytes, words and double words are read in (potentially) a random order.
void SeekTo(size_t pos, int mode)
Seek in the current file.
std::string filename
Full name of the file; relative path to subdir plus the extension of the file.
RandomAccessFile with some extra information specific for sprite files.
uint8_t container_version
Container format of the sprite file.
bool NeedsPaletteRemap() const
Whether a palette remap is needed when loading sprites from this file.
uint8_t GetContainerVersion() const
Get the version number of container type used by the file.
size_t content_begin
The begin of the content of the sprite file, i.e. after the container metadata.
void SeekToBegin()
Seek to the begin of the content, i.e.
bool palette_remap
Whether or not a remap of the palette is required for this file.
Subdirectory
The different kinds of subdirectories OpenTTD uses.