Reading graphics data from (New)GRF files. More...
#include "../stdafx.h"#include "../gfx_func.h"#include "../fileio_func.h"#include "../debug.h"#include "../strings_func.h"#include "table/strings.h"#include "../error.h"#include "../core/math_func.hpp"#include "../core/alloc_type.hpp"#include "../core/bitmath_func.hpp"#include "grf.hpp"Go to the source code of this file.
Enumerations | |
| enum | SpriteColourComponent { SCC_RGB = 1 << 0, SCC_ALPHA = 1 << 1, SCC_PAL = 1 << 2, SCC_MASK = SCC_RGB | SCC_ALPHA | SCC_PAL } |
The different colour components a sprite can have. More... | |
Functions | |
| static bool | WarnCorruptSprite (uint8 file_slot, size_t file_pos, int line) |
| We found a corrupted sprite. | |
| bool | DecodeSingleSprite (SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type, int64 num, byte type, ZoomLevel zoom_lvl, byte colour_fmt, byte container_format) |
| Decode the image data of a single sprite. | |
| uint8 | LoadSpriteV1 (SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type, bool load_32bpp) |
| uint8 | LoadSpriteV2 (SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type, bool load_32bpp) |
Variables | |
| const byte | _palmap_w2d [] |
Reading graphics data from (New)GRF files.
Definition in file grf.cpp.
| bool DecodeSingleSprite | ( | SpriteLoader::Sprite * | sprite, | |
| uint8 | file_slot, | |||
| size_t | file_pos, | |||
| SpriteType | sprite_type, | |||
| int64 | num, | |||
| byte | type, | |||
| ZoomLevel | zoom_lvl, | |||
| byte | colour_fmt, | |||
| byte | container_format | |||
| ) |
Decode the image data of a single sprite.
| [in,out] | sprite | Filled with the sprite image data. |
| file_slot | File slot. | |
| 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 68 of file grf.cpp.
References _palette_remap_grf, SpriteLoader::CommonPixel::a, SpriteLoader::Sprite::AllocateData(), SpriteLoader::CommonPixel::b, SpriteLoader::Sprite::data, DEBUG, FioGetFilename(), FioReadByte(), SpriteLoader::CommonPixel::g, SpriteLoader::Sprite::height, SpriteLoader::CommonPixel::m, min(), SpriteLoader::CommonPixel::r, SCC_ALPHA, SCC_PAL, SCC_RGB, ST_FONT, ST_NORMAL, WarnCorruptSprite(), and SpriteLoader::Sprite::width.
| static bool WarnCorruptSprite | ( | uint8 | file_slot, | |
| size_t | file_pos, | |||
| int | line | |||
| ) | [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 43 of file grf.cpp.
References DEBUG, FioGetFilename(), INVALID_STRING_ID, SetDParamStr(), ShowErrorMessage(), and WL_ERROR.
Referenced by DecodeSingleSprite().
1.7.1