|
OpenTTD Source 20251117-master-g7398d2e290
|
RandomAccessFile with some extra information specific for sprite files. More...
#include <sprite_file_type.hpp>
Public Member Functions | |
| SpriteFile (const std::string &filename, Subdirectory subdir, bool palette_remap) | |
| Create the SpriteFile. | |
| SpriteFile (const SpriteFile &)=delete | |
| void | operator= (const SpriteFile &)=delete |
| 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. | |
| void | SeekToBegin () |
| Seek to the begin of the content, i.e. | |
Public Member Functions inherited from RandomAccessFile | |
| RandomAccessFile (std::string_view filename, Subdirectory subdir) | |
| Create the RandomAccesFile. | |
| RandomAccessFile (const RandomAccessFile &)=delete | |
| void | operator= (const RandomAccessFile &)=delete |
| const std::string & | GetFilename () const |
| Get the filename of the opened file with the path from the SubDirectory and the extension. | |
| const std::string & | GetSimplifiedFilename () const |
| Get the simplified filename of the opened file. | |
| size_t | GetPos () const |
| Get position in the file. | |
| size_t | GetStartPos () const |
| size_t | GetEndPos () const |
| void | SeekTo (size_t pos, int mode) |
| Seek in the current file. | |
| bool | AtEndOfFile () const |
| Test if we have reached the end of the file. | |
| uint8_t | ReadByte () |
| Read a byte from the file. | |
| uint16_t | ReadWord () |
| Read a word (16 bits) from the file (in low endian format). | |
| uint32_t | ReadDword () |
| Read a double word (32 bits) from the file (in low endian format). | |
| void | ReadBlock (void *ptr, size_t size) |
| Read a block. | |
| void | SkipBytes (size_t n) |
| Skip n bytes ahead in the file. | |
Private Attributes | |
| bool | palette_remap |
| Whether or not a remap of the palette is required for this file. | |
| uint8_t | container_version |
| Container format of the sprite file. | |
| size_t | content_begin |
| The begin of the content of the sprite file, i.e. after the container metadata. | |
RandomAccessFile with some extra information specific for sprite files.
It automatically detects and stores the container version upload opening the file.
Definition at line 19 of file sprite_file_type.hpp.
| SpriteFile::SpriteFile | ( | const std::string & | filename, |
| Subdirectory | subdir, | ||
| bool | palette_remap | ||
| ) |
Create the SpriteFile.
| filename | Name of the file at the disk. |
| subdir | The sub directory to search this file in. |
| palette_remap | Whether a palette remap needs to be performed for this file. |
Definition at line 46 of file sprite_file.cpp.
References container_version, content_begin, GetGRFContainerVersion(), and RandomAccessFile::GetPos().
|
inline |
Get the version number of container type used by the file.
Definition at line 38 of file sprite_file_type.hpp.
References container_version.
Referenced by LoadGrfFile(), LoadGrfFileIndexed(), LoadGRFSound(), LoadNewGRFFileFromFile(), LoadNextSprite(), ReadGRFSpriteOffsets(), and ReadSprite().
|
inline |
Whether a palette remap is needed when loading sprites from this file.
Definition at line 32 of file sprite_file_type.hpp.
References palette_remap.
Referenced by DecodeSingleSprite(), and ReadRecolourSprite().
|
inline |
Seek to the begin of the content, i.e.
the position just after the container version has been determined.
Definition at line 43 of file sprite_file_type.hpp.
References RandomAccessFile::SeekTo().
Referenced by OpenCachedSpriteFile().
|
private |
Container format of the sprite file.
Definition at line 21 of file sprite_file_type.hpp.
Referenced by GetContainerVersion(), and SpriteFile().
|
private |
The begin of the content of the sprite file, i.e. after the container metadata.
Definition at line 22 of file sprite_file_type.hpp.
Referenced by SpriteFile().
|
private |
Whether or not a remap of the palette is required for this file.
Definition at line 20 of file sprite_file_type.hpp.
Referenced by NeedsPaletteRemap().