|
OpenTTD Source 20251116-master-g21329071df
|
Reading graphics data from (New)GRF files. More...
#include "../stdafx.h"#include "../gfx_func.h"#include "../debug.h"#include "../settings_type.h"#include "../strings_func.h"#include "../error.h"#include "../core/math_func.hpp"#include "../core/alloc_type.hpp"#include "../core/bitmath_func.hpp"#include "../spritecache.h"#include "grf.hpp"#include "table/strings.h"#include "../safeguards.h"Go to the source code of this file.
Functions | |
| static bool | WarnCorruptSprite (const SpriteFile &file, size_t file_pos, int line) |
| We found a corrupted sprite. | |
| bool | DecodeSingleSprite (SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, int64_t num, uint8_t type, ZoomLevel zoom_lvl, SpriteComponents colour_fmt, uint8_t container_format) |
| Decode the image data of a single sprite. | |
| static ZoomLevels | LoadSpriteV1 (SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, ZoomLevels &avail_8bpp) |
| static ZoomLevels | LoadSpriteV2 (SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, SpriteCacheCtrlFlags control_flags, ZoomLevels &avail_8bpp, ZoomLevels &avail_32bpp) |
Variables | |
| const uint8_t | _palmap_w2d [] |
Reading graphics data from (New)GRF files.
Definition in file grf.cpp.
| bool DecodeSingleSprite | ( | SpriteLoader::Sprite * | sprite, |
| SpriteFile & | file, | ||
| size_t | file_pos, | ||
| SpriteType | sprite_type, | ||
| int64_t | num, | ||
| uint8_t | type, | ||
| ZoomLevel | zoom_lvl, | ||
| SpriteComponents | colour_fmt, | ||
| uint8_t | container_format | ||
| ) |
Decode the image data of a single sprite.
| [in,out] | sprite | Filled with the sprite image data. |
| file | The file with the sprite data. | |
| file_pos | File position. | |
| sprite_type | Type of the sprite we're decoding. | |
| num | Size of the decompressed sprite. | |
| type | Type of the encoded sprite. | |
| zoom_lvl | Requested zoom level. | |
| colour_fmt | Colour format of the sprite. | |
| container_format | Container format of the GRF this sprite is in. |
Definition at line 60 of file grf.cpp.
References SpriteLoader::CommonPixel::a, SpriteLoader::Sprite::AllocateData(), Alpha, SpriteLoader::CommonPixel::b, SpriteLoader::Sprite::data, Debug, Font, SpriteLoader::CommonPixel::g, RandomAccessFile::GetSimplifiedFilename(), SpriteLoader::Sprite::height, SpriteLoader::CommonPixel::m, SpriteFile::NeedsPaletteRemap(), Normal, Palette, SpriteLoader::CommonPixel::r, RandomAccessFile::ReadByte(), RGB, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WarnCorruptSprite(), and SpriteLoader::Sprite::width.
|
static |
|
static |
|
static |
We found a corrupted sprite.
This means that the sprite itself contains invalid data or is too small for the given dimensions.
| file_slot | the file the errored sprite is in |
| file_pos | the location in the file of the errored sprite |
| line | the line where the error occurs. |
Definition at line 36 of file grf.cpp.
References Debug, GetEncodedString(), RandomAccessFile::GetSimplifiedFilename(), ShowErrorMessage(), and WL_ERROR.
Referenced by DecodeSingleSprite().