OpenTTD Source
20241120-master-g6d3adc6169
|
Initializing of the (GRF) graphics. More...
#include "stdafx.h"
#include "fios.h"
#include "newgrf.h"
#include "3rdparty/md5/md5.h"
#include "fontcache.h"
#include "gfx_func.h"
#include "transparency.h"
#include "blitter/factory.hpp"
#include "video/video_driver.hpp"
#include "window_func.h"
#include "palette_func.h"
#include "base_media_func.h"
#include "table/sprites.h"
#include "safeguards.h"
#include "table/landscape_sprite.h"
Go to the source code of this file.
Macros | |
#define | SET_TYPE "graphics" |
Functions | |
static uint | LoadGrfFile (const std::string &filename, SpriteID load_index, bool needs_palette_remap) |
Load an old fashioned GRF file. More... | |
static void | LoadGrfFileIndexed (const std::string &filename, std::span< const std::pair< SpriteID, SpriteID >> index_tbl, bool needs_palette_remap) |
Load an old fashioned GRF file to replace already loaded sprites. More... | |
void | CheckExternalFiles () |
Checks whether the MD5 checksums of the files are correct. More... | |
static void | LoadSpriteTables () |
Actually load the sprite tables. | |
static void | RealChangeBlitter (const std::string_view repl_blitter) |
static bool | SwitchNewGRFBlitter () |
Check blitter needed by NewGRF config and switch if needed. More... | |
void | CheckBlitter () |
Check whether we still use the right blitter, or use another (better) one. | |
void | GfxLoadSprites () |
Initialise and load all the sprites. | |
Variables | |
static constexpr std::span< const std::pair< SpriteID, SpriteID > > | _landscape_spriteindexes [] |
Offsets for loading the different "replacement" sprites in the files. More... | |
static const char *const | _graphics_file_names [] = { "base", "logos", "arctic", "tropical", "toyland", "extra" } |
Names corresponding to the GraphicsFileType. | |
Initializing of the (GRF) graphics.
Definition in file gfxinit.cpp.
void CheckExternalFiles | ( | ) |
Checks whether the MD5 checksums of the files are correct.
Definition at line 114 of file gfxinit.cpp.
References BASESET_DIR, BaseSet< SoundsSet, 1, true >::CheckMD5(), GraphicsSet::CheckMD5(), MD5File::CR_MATCH, MD5File::CR_MISMATCH, Debug, MD5File::filename, BaseSet< T, Tnum_files, Tsearch_in_tars >::files, BaseSet< T, Tnum_files, Tsearch_in_tars >::GetNumInvalid(), BaseMedia< GraphicsSet >::GetUsedSet(), BaseMedia< SoundsSet >::GetUsedSet(), MD5File::missing_warning, BaseSet< T, Tnum_files, Tsearch_in_tars >::name, and BaseSet< SoundsSet, 1, true >::NUM_FILES.
Referenced by BaseMedia< Tbase_set >::SetSet().
|
static |
Load an old fashioned GRF file.
filename | The name of the file to open. |
load_index | The offset of the first sprite. |
needs_palette_remap | Whether the colours in the GRF file need a palette remap. |
Definition at line 46 of file gfxinit.cpp.
References BASESET_DIR, Debug, SpriteFile::GetContainerVersion(), and OpenCachedSpriteFile().
Referenced by LoadSpriteTables().
|
static |
Load an old fashioned GRF file to replace already loaded sprites.
filename | The name of the file to open. |
index_tbl | The offsets of each of the sprites. |
needs_palette_remap | Whether the colours in the GRF file need a palette remap. |
Definition at line 83 of file gfxinit.cpp.
References BASESET_DIR, Debug, SpriteFile::GetContainerVersion(), and OpenCachedSpriteFile().
|
static |
Check blitter needed by NewGRF config and switch if needed.
< 0: no support, 1: do support, 2: both
Definition at line 245 of file gfxinit.cpp.
References _blitter_autodetected, GraphicsSet::blitter, BLT_32BPP, BlitterFactory::GetCurrentBlitter(), and BaseMedia< GraphicsSet >::GetUsedSet().
Referenced by CheckBlitter(), and GfxLoadSprites().
|
staticconstexpr |
Offsets for loading the different "replacement" sprites in the files.
Definition at line 33 of file gfxinit.cpp.