12#include "../spritecache.h"
16#include "../table/sprites.h"
18#include "../safeguards.h"
28 for (
const auto &grm_sprite : _grm_sprites) {
29 if (grm_sprite.first.grfid != _cur.
grffile->grfid)
continue;
30 if (grm_sprite.second.first <= first_sprite && grm_sprite.second.first + grm_sprite.second.second >= first_sprite + num_sprites)
return true;
48 for (uint i = 0; i < num_sets; i++) {
49 uint8_t num_sprites = buf.
ReadByte();
50 uint16_t first_sprite = buf.
ReadWord();
52 GrfMsg(2,
"SpriteReplace: [Set {}] Changing {} sprites, beginning with {}",
53 i, num_sprites, first_sprite
59 GrfMsg(0,
"SpriteReplace: [Set {}] Changing {} sprites, beginning with {}, above limit of {} and not within reserved range, ignoring.",
68 for (uint j = 0; j < num_sprites; j++) {
69 SpriteID load_index = first_sprite + j;
75 if (
IsInsideMM(load_index, SPR_ORIGINALSHORE_START, SPR_ORIGINALSHORE_END + 1)) {
87 for (uint i = 0; i < num_sets; i++) {
94 GrfMsg(3,
"SkipActA: Skipping {} sprites", _cur.
skip_sprites);
Class to read from a NewGRF file.
uint16_t ReadWord()
Read a single Word (16 bits).
uint8_t ReadByte()
Read a single byte (8 bits).
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
constexpr bool IsInsideMM(const size_t x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
@ SHORE_REPLACE_ACTION_A
Shore sprites were replaced by ActionA (using grass tiles for the corner-shores).
@ SHORE_REPLACE_ACTION_5
Shore sprites were replaced by Action5.
static bool IsGRMReservedSprite(SpriteID first_sprite, uint16_t num_sprites)
Check if a sprite ID range is within the GRM reversed range for the currently loading NewGRF.
NewGRF buffer reader definition.
NewGRF internal processing state.
bool LoadNextSprite(SpriteID load_index, SpriteFile &file, uint file_sprite_id)
Load a real or recolour sprite.
static const SpriteID SPR_OPENTTD_BASE
Extra graphic spritenumbers.
ShoreReplacement shore
In which way shore sprites were replaced.
SpriteFile * file
File of currently processed GRF file.
GRFFile * grffile
Currently processed GRF file.
uint32_t nfo_line
Currently processed pseudo sprite number in the GRF.
SpriteID spriteid
First available SpriteID for loading realsprites.
int skip_sprites
Number of pseudo sprites to skip before processing the next one. (-1 to skip to end of file)