|
OpenTTD Source 20251117-master-g7398d2e290
|
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 "base_media_graphics.h"#include "base_media_sounds.h"#include "table/sprites.h"#include "safeguards.h"#include "table/landscape_sprite.h"Go to the source code of this file.
Functions | |
| static uint | LoadGrfFile (const std::string &filename, SpriteID load_index, bool needs_palette_remap) |
| Load an old fashioned GRF file. | |
| 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. | |
| void | CheckExternalFiles () |
| Checks whether the MD5 checksums of the files are correct. | |
| static std::unique_ptr< GRFConfig > | GetDefaultExtraGRFConfig () |
| Get GRFConfig for the default extra graphics. | |
| static std::unique_ptr< GRFConfig > | GetBasesetExtraGRFConfig () |
| Get GRFConfig for the baseset extra graphics. | |
| static void | LoadSpriteTables () |
| Actually load the sprite tables. | |
| static void | RealChangeBlitter (std::string_view repl_blitter) |
| static bool | SwitchNewGRFBlitter () |
| Check blitter needed by NewGRF config and switch if needed. | |
| 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. | |
| static const std::string_view | _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 CheckBlitter | ( | ) |
Check whether we still use the right blitter, or use another (better) one.
Definition at line 325 of file gfxinit.cpp.
References FontCache::ClearFontCaches(), FONTSIZES_ALL, GfxClearSpriteCache(), ReInitAllWindows(), and SwitchNewGRFBlitter().
Referenced by MenuClickSettings(), and GameOptionsWindow::OnDropdownSelect().
| void CheckExternalFiles | ( | ) |
Checks whether the MD5 checksums of the files are correct.
Definition at line 113 of file gfxinit.cpp.
References BASESET_DIR, BaseSet< SoundsSet >::CheckMD5(), GraphicsSet::CheckMD5(), MD5File::CR_MATCH, MD5File::CR_MISMATCH, Debug, BaseSet< T >::files, BaseSet< T >::GetNumInvalid(), BaseMedia< SoundsSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), BaseSet< T >::name, and BaseSet< SoundsSet >::NUM_FILES.
Referenced by BaseMedia< Tbase_set >::SetSet().
|
static |
Get GRFConfig for the baseset extra graphics.
Definition at line 163 of file gfxinit.cpp.
References BaseMedia< GraphicsSet >::GetUsedSet(), and InitOnly.
Referenced by LoadSpriteTables().
|
static |
Get GRFConfig for the default extra graphics.
Definition at line 150 of file gfxinit.cpp.
References BASESET_DIR, FillGRFDetails(), GRFP_GRF_DOS, and InitOnly.
Referenced by LoadSpriteTables().
| void GfxLoadSprites | ( | ) |
Initialise and load all the sprites.
Definition at line 335 of file gfxinit.cpp.
References _settings_game, FontCache::ClearFontCaches(), VideoDriver::ClearSystemSprites(), Debug, FONTSIZES_ALL, GameSettings::game_creation, VideoDriver::GetInstance(), GameCreationSettings::landscape, LoadSpriteTables(), SwitchNewGRFBlitter(), and UpdateCursorSize().
Referenced by AfterLoadGame(), GenerateWorld(), and ReloadNewGRFData().
|
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 45 of file gfxinit.cpp.
References BASESET_DIR, Debug, SpriteFile::GetContainerVersion(), LoadNextSprite(), MAX_SPRITES, OpenCachedSpriteFile(), RandomAccessFile::ReadByte(), and ReadGRFSpriteOffsets().
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 82 of file gfxinit.cpp.
References BASESET_DIR, Debug, SpriteFile::GetContainerVersion(), LoadNextSprite(), OpenCachedSpriteFile(), RandomAccessFile::ReadByte(), and ReadGRFSpriteOffsets().
Referenced by LoadSpriteTables().
|
static |
Actually load the sprite tables.
Definition at line 172 of file gfxinit.cpp.
References _grfconfig, _landscape_spriteindexes, _missing_extra_graphics, _settings_game, Debug, BaseSet< T >::files, GameSettings::game_creation, GetBasesetExtraGRFConfig(), GetDefaultExtraGRFConfig(), GetSpriteCountForFile(), BaseMedia< GraphicsSet >::GetUsedSet(), GFT_ARCTIC, GFT_BASE, GFT_LOGOS, InitializeUnicodeGlyphMap(), GameCreationSettings::landscape, LoadGrfFile(), LoadGrfFileIndexed(), LoadNewGRF(), PAL_DOS, GraphicsSet::palette, SPR_OPENTTD_BASE, and to_underlying().
Referenced by GfxLoadSprites().
|
static |
Definition at line 231 of file gfxinit.cpp.
|
static |
Check blitter needed by NewGRF config and switch if needed.
< 0: no support, 1: do support, 2: both
Definition at line 257 of file gfxinit.cpp.
References _blitter_autodetected, _display_opt, _grfconfig, GraphicsSet::blitter, BLT_32BPP, DO_FULL_ANIMATION, GCS_DISABLED, GCS_NOT_FOUND, BlitterFactory::GetBlitterFactory(), BlitterFactory::GetCurrentBlitter(), VideoDriver::GetInstance(), Blitter::GetName(), BaseMedia< GraphicsSet >::GetUsedSet(), GRFP_BLT_32BPP, HasBit(), InitOnly, IsInsideMM(), VideoDriver::QueueOnMainThread(), and S8BPP_NONE.
Referenced by CheckBlitter(), and GfxLoadSprites().
|
static |
Names corresponding to the GraphicsFileType.
Definition at line 467 of file gfxinit.cpp.
|
staticconstexpr |
Offsets for loading the different "replacement" sprites in the files.
Definition at line 32 of file gfxinit.cpp.
Referenced by LoadSpriteTables().